예제 #1
0
 void Start()
 {
     if (itemType != 0)
     {
         gun = null;
     }
 }
예제 #2
0
 public itemObject()
 {
     itemID   = -1;
     itemType = -1;
     itemCode = -1;
     image    = null;
     name     = "";
     gun      = null;
 }
예제 #3
0
    private void Update()
    {
        if (alive)
        {
            if (mygun != null && mygun.inHand)
            {
                switch (mygun.name)
                {
                case "uzi":
                    myAnimator.showUzi();
                    break;

                case "gun":
                    myAnimator.showGun();
                    break;

                case "mp":
                    myAnimator.showMp();
                    break;
                }
                if (!mygun.singleShoot)
                {
                    if (Input.GetMouseButton(0))
                    {
                        mygun.shoot = true;
                    }
                }
                else
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        mygun.shoot = true;
                    }
                }
            }


            else
            {
                noWeaponEquipt();
            }


            checkMoveInput();

            if (GetComponentInChildren <gunCheck>().mygun != null)
            {
                mygun = GetComponentInChildren <gunCheck>().mygun;
            }
        }
        else
        {
            deadfunction();
        }
    }
예제 #4
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "gun" && !collision.GetComponent <gunObject>().inHand)
     {
         Debug.Log("Player exits: Gun");
         this.gunOnFloor = null;
     }
     if (collision.tag == "granate" && !collision.GetComponent <granateSkript>().inHand)
     {
         Debug.Log("Player exits: Granade");
         this.granateOnFloor = null;
     }
 }
예제 #5
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;
             }
         }
     }
 }
예제 #6
0
    public void setDead(bool deadState, string killer)
    {
        if (this.dead == deadState)
        {
            return;
        }

        this.dead = deadState;
        Debug.Log("Dead by " + killer);
        if (child.childCount > 0)
        {
            audioManager.PlaySound("enemy");
            Debug.Log("stirb");
            child.GetChild(0).gameObject.SetActive(false);
        }


        if (mygun != null)
        {
            mygun.switchHandState();
        }

        gameObject.GetComponent <SpriteRenderer>().sortingOrder = -5;
        gameObject.GetComponent <Animator>().SetBool("gun", false);
        gameObject.GetComponent <Animator>().SetBool("mp", false);
        gameObject.GetComponent <Animator>().SetBool("uzi", false);

        gameObject.GetComponent <Animator>().SetBool("dead", true);

        gameObject.GetComponent <BoxCollider2D>().isTrigger = true;

        if (mygun != null)
        {
            gameObject.transform.DetachChildren();
            mygun = null;
        }


        gameObject.GetComponentInParent <EnemyAI>().enabled            = false;
        gameObject.GetComponentInParent <pathSkript>().enabled         = false;
        gameObject.GetComponentInParent <CircleCollider2D>().isTrigger = true;
        gameObject.GetComponentInParent <AIController>().enabled       = false;
    }
예제 #7
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();
         }
     }
 }
예제 #8
0
 private void FixedUpdate()
 {
     gunOfPlayer     = FindObjectOfType <PlayerMovement>().mygun;
     granadeOfPlayer = FindObjectOfType <PlayerMovement>().myGranate;
 }