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); } }
void killPlayer() { if (this.GetComponent <PlayerAnimate> ().enabled == true) { PlayerAnimate pa = this.GetComponent <PlayerAnimate> (); PlayerMovement pm = this.GetComponent <PlayerMovement> (); RotateToCursor rot = this.GetComponent <RotateToCursor> (); WeaponAttack wa = this.GetComponent <WeaponAttack> (); legDir ld = this.GetComponentInChildren <legDir> (); wa.dropWeapon(); pa.legs.sprite = null; pa.legs.enabled = false; ld.enabled = false; pa.torso.sprite = deadSpr; pa.enabled = false; rot.enabled = false; wa.enabled = false; pm.enabled = false; CircleCollider2D col = this.GetComponent <CircleCollider2D> (); col.enabled = false; } }
void revivePlayer() { dead = false; Debug.Log("PlayerHealth - revivePlayer"); PlayerAnimate pa = this.GetComponent <PlayerAnimate> (); PlayerMovement pm = this.GetComponent <PlayerMovement> (); RotateToCursor rot = this.GetComponent <RotateToCursor> (); WeaponAttack wa = this.GetComponent <WeaponAttack> (); dead = false; legDir ld = this.GetComponentInChildren <legDir> (); wa.dropWeapon(); pa.legs.enabled = true; ld.enabled = true; pa.enabled = true; rot.enabled = true; wa.enabled = true; pm.enabled = true; CircleCollider2D col = this.GetComponent <CircleCollider2D> (); col.enabled = true; }
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); } }
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; } }
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); } }
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); } }
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); } }
public void revivePlayer() { PlayerAnimate pa = this.GetComponent <PlayerAnimate>(); playermovement pm = this.GetComponent <playermovement>(); rotateToCursor rot = this.GetComponent <rotateToCursor>(); WeaponAttack wa = this.GetComponent <WeaponAttack>(); LegsDirection legDir = this.GetComponentInChildren <LegsDirection>(); wa.dropWeapon(); pa.legs.enabled = true; legDir.enabled = true; pa.enabled = true; rot.enabled = true; wa.enabled = true; pm.enabled = true; dead = false; }
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); } }
void KillPlayer() { if (this.GetComponent <PlayerAnimate>().enabled == true) { PlayerAnimate pa = this.GetComponent <PlayerAnimate>(); playermovement pm = this.GetComponent <playermovement>(); rotateToCursor rot = this.GetComponent <rotateToCursor>(); WeaponAttack wa = this.GetComponent <WeaponAttack>(); LegsDirection legDir = this.GetComponentInChildren <LegsDirection>(); wa.dropWeapon(); pa.legs.sprite = null; pa.legs.enabled = false; legDir.enabled = false; pa.torso.sprite = deadSpr; pa.enabled = false; rot.enabled = false; wa.enabled = false; pm.enabled = false; BoxCollider2D col = this.GetComponent <BoxCollider2D>(); col.enabled = false; } }