示例#1
0
 void Update()
 {
     if (close)
     {
         if (timer > 0.7F)
         {
             close = false;
         }
         else
         {
             if (Input.GetAxis("Horizontal2") != 0 || Input.GetAxis("Vertical2") != 0)
             {
                 if (Input.GetAxis("Horizontal2") == -1)
                 {
                     // Take away health from user *one option is to take resources back*
                     tmp           = Instantiate(missiles, tr.position, Quaternion.identity) as GameObject;
                     become        = tmp.GetComponent <missiles>();
                     become.father = claimant.transform;
                     tmp.SetActive(true);
                     user.health -= 8;
                     Destroy(gameObject);
                 }
                 else if (Input.GetAxis("Horizontal2") == 1)
                 {
                     ;
                 }
                 else if (Input.GetButtonDown("Vertical2"))
                 {
                     if (Input.GetAxis("Vertical2") == 1)
                     {
                         Player.burstCocked = true;
                         user.health       -= 8;
                         Destroy(gameObject);
                     }
                     else if (Input.GetAxis("Vertical2") == -1)
                     {
                         ;
                     }
                 }
             }
             timer += Time.deltaTime;
         }
     }
 }
示例#2
0
 void Awake()
 {
     target = transform.parent.gameObject;
     papi   = target.GetComponent <missiles>();
     target = papi.target.gameObject;
 }