Esempio n. 1
0
 private void CheckForMouseInput()
 {
     if (Input.GetMouseButton(0))
     {
         ray = Camera.main.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);
             }
         }
     }
 }
Esempio n. 2
0
    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;
                }
            }
        }
    }