| 12345678910111213141516171819202122232425 |
- using UnityEngine;
- public class Bow : MonoBehaviour
- {
- public static Bow Instance;
- void Start()
- {
- Instance = this;
- }
- void Update()
- {
- #if UNITY_EDITOR
- if (Input.GetKeyDown(KeyCode.S)) Shoot();
- #endif
- }
- public void Shoot()
- {
- Transform bowTF = transform;
- Transform arrowTF = transform.Find("Arrow");
- Instantiate(arrowTF.gameObject, arrowTF.position, bowTF.rotation).SetActive(true);
- }
- }
|