Exemplo n.º 1
0
    void OnTriggerStay2D(Collider2D coll)
    {
        //Debug.Log ("Collision");
        if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))
        {
            //code to add weapon to player
            Debug.Log("Player picked up: " + name);
            if (wa.getCur() != null)
            {
                wa.dropWeapon();
            }
            wa.setWeapon(this.gameObject, name, fireRate, gun, oneHanded, shotugn);        //added one handed
            //Destroy (this.gameObject);
            this.gameObject.SetActive(false);
        }
        else if (coll.gameObject.tag == "Enemy" && coll.gameObject.GetComponent <EnemyWeaponController>().getCur() == null)  //New for tut 7
        {
            Debug.Log("Enemy picked up: " + name);

            EnemyWeaponController ewc = coll.gameObject.GetComponent <EnemyWeaponController> ();
            ewc.setWeapon(this.gameObject, name, fireRate, gun, oneHanded, shotugn);        //added one handed
            //Destroy (this.gameObject);
            this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
 private void OnTriggerStay2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))
     {
         if (weaponAttack.getCur() != null)
         {
             weaponAttack.dropWeapon();
         }
         weaponAttack.setWeapon(this.gameObject, name, fireRate, gun);
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 3
0
 void OnTriggerStay2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Player" && Input.GetKeyDown(KeyCode.E))
     {
         Debug.Log("Player picked up " + weaponName);
         if (wa.getCurr() != null)
         {
             wa.DropWeapon();
         }
         wa.setWeapon(this.gameObject, weaponName);
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 4
0
 void OnTriggerStay2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "player" && isPlayerOut == true)
     {
         if (wa.getCur() != null)
         {
             wa.dropWeapon();
         }
         wa.setWeapon(this.gameObject, weaponName, fireRate, gun);
         this.gameObject.SetActive(false);
         isPlayerOut = false;
     }
 }
Exemplo n.º 5
0
 void OnTriggerStay2D(Collider2D coll)
 {
     Debug.Log("collision");
     if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))
     {
         Debug.Log("Player Picked up: " + weaponName);
         if (wa.getCur() != null)
         {
             wa.dropWeapon();
         }
         wa.setWeapon(this.gameObject, weaponName);
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 6
0
 void OnTriggerStay2D(Collider2D coll)
 {
     Debug.Log("Collision");
     if (coll.gameObject.tag == "Player" && Input.GetKey(KeyCode.LeftShift))
     {
         Debug.Log("Player picked up: " + name);
         if (wa.getCur() != null)
         {
             wa.dropWeapon();
         }
         wa.setWeapon(this.gameObject, name, fireRate, gun, onehanded);
         //Destroy game object
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 7
0
    void OnTriggerStay2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))            //right mouse button to pickup the weapon
        //code to add weapon to player

        {
            Debug.Log("Player picked up:" + name2);              //if player already has a weapon it will drop the current weapon
            if (wa.getCur() != null)
            {
                wa.dropWeapon();
            }
            wa.setWeapon(this.gameObject, name2, fireRate, gun, oneHanded);              //passing the name of sprite, firerate, attacking script (gun,meelee, shotgun)
            // DESTROY THIS GAMEOBJECT
            this.gameObject.SetActive(false);
        }
    }
Exemplo n.º 8
0
    void OnTriggerStay2D(Collider2D coll)
    {
        Debug.Log("Collision");
        if (coll.gameObject.tag == "Player" && Input.GetMouseButtonDown(1))
        {
            Debug.Log("Player picke up:" + name);
            if (wa.getCur() != null)
            {
                wa.dropWeapon();
            }
            wa.setWeapon(this.gameObject, name, fireRate, gun, oneHanded, shotgun);

            this.gameObject.SetActive(false);
        }
        else if (coll.gameObject.tag == "Enemy" && coll.gameObject.GetComponent <EnemyWeponContoller>().getCur() == null)
        {
            Debug.Log("Enemy picked up " + name);
            EnemyWeponContoller ewc = coll.gameObject.GetComponent <EnemyWeponContoller>();
            ewc.setWeapon(this.gameObject, name, fireRate, gun, oneHanded);
            this.gameObject.SetActive(false);
        }
    }