示例#1
0
    void HandleMouse(TWeaponMode _mode)
    {
        if(_mode == TWeaponMode.RESET)
            Reset();

        if(_mode == TWeaponMode.ATTRACT)
        {
            Debug.Log(hasPos);
            Debug.Log(target_1);

              RaycastHit hit;
              Ray ray = playerCamera.ScreenPointToRay(new Vector2(Screen.width/2.0f,Screen.height/2.0f));
              Debug.Log("OnRayCast "+Input.mousePosition.ToString());
              if (Physics.Raycast (ray, out hit, 10000.0f))
              {

                 if(hit.collider.GetComponent<AttractObjectScript>() != null)
                {
                    target_1 = hit.collider.gameObject;
                    Debug.Log(target_1.name);
                }
                 else
                {
                    target_pos = hit.point;
                    hasPos = true;
                    Debug.Log(hit.collider.gameObject.name);
                    Debug.Log(hit.point.ToString());
                }
              }
            if(hasPos && target_1 != null)
            {
                Debug.Log("ApplyEffect");
                ApplyEffect();
                return;
            }
        }
    }
示例#2
0
 void Reset()
 {
     if(target_1 != null)
         target_1.GetComponent<AttractObjectScript>().Stop();
     target_1 = null;
     //target_2 = null;
     hasPos = false;
     mode = TWeaponMode.NO_MODE;
 }