示例#1
0
 private void FixedUpdate()
 {
     if (mygun != null && !this.dead)
     {
         if (punched)
         {
             gameObject.GetComponent <Animator>().SetBool("gun", false);
             gameObject.GetComponent <Animator>().SetBool("mp", false);
             gameObject.GetComponent <Animator>().SetBool("uzi", false);
             if (mygun != null)
             {
                 mygun.switchHandState();
                 mygun = null;
             }
         }
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (gameObject.transform.childCount > 0)
        {
            if (Input.GetMouseButtonDown(1))
            {
                if (mygun == gameObject.transform.GetChild(0).GetComponent <gunObject>() && myGranate == null)
                {
                    mygun.switchHandState();
                }
                else if (myGranate != null)
                {
                    myGranate.switchHandState();
                }

                else
                {
                    gameObject.transform.GetChild(0).GetComponent <gunObject>().switchHandState();
                }
            }
        }
    }
示例#3
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.tag == "gun" && !this.gunOnFloor.inHand)
     {
         Debug.Log("Player staying in: Gun");
         if (Input.GetMouseButton(1))
         {
             mygun       = this.gunOnFloor;
             mygun.Owner = gameObject;
             mygun.switchHandState();
         }
     }
     if (collision.tag == "granate" && !this.granateOnFloor.inHand)
     {
         Debug.Log("Player staying in: Granade");
         if (Input.GetMouseButton(1))
         {
             myGranate       = this.granateOnFloor;
             myGranate.Owner = gameObject;
             myGranate.switchHandState();
         }
     }
 }