void Start() { instance = this; pressureForce = 20f; energyID = 0; BattleCamera = GameObject.Find("BattleCamera"); battleCamera = BattleCamera.GetComponent <Camera>(); jellyBodyStatus = JellyBody.Status.released;//これ、つかってなくね? }
public void CheckForTouch() { if (Input.GetMouseButton(0)) { ray = battleCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hitInfo)) { jellyBody = hitInfo.collider.gameObject.GetComponent <JellyBody>(); if (jellyBody != null) { inputPoint = hitInfo.point; inputPoint += hitInfo.normal * 0.1f; jellyBody.AddPointForce(pressureForce, inputPoint); //どのエネルギーにタッチしたか、そのIDを返す //IDは個々にpublicで設定 jellyBodyStatus = JellyBody.Status.touched; energyID = jellyBody.id; } } } }
public void Update() { CheckForTouch(); GetEnergyID(); jellyBodyStatus = JellyBody.Status.released; }