// This one function will handle the multiple types of death possible to the player // Parameters: The function takes in a TYPE_DEATH and uses that to determine // which actions to take. public void PlayerDeath(TYPE_DEATH method) { if (method == TYPE_DEATH.MELEE) this.GetComponent<Invisiblilityscript> ().SetExposure (0); //GetComponent<Transform> ().position = new Vector3 (20.0f, 20.0f, 0.0f); }
// This one function will handle the multiple types of death possible to the player // Parameters: The function takes in a TYPE_DEATH and uses that to determine // which actions to take. public void PlayerDeath(TYPE_DEATH method) { if (method == TYPE_DEATH.MELEE) { this.GetComponent <Invisiblilityscript> ().SetExposure(0); } //GetComponent<Transform> ().position = new Vector3 (20.0f, 20.0f, 0.0f); }
// This one function will handle the multiple types of death possible to the player // Parameters: The function takes in a TYPE_DEATH and uses that to determine // which actions to take. public void PlayerDeath(TYPE_DEATH method) { if (GetComponent<Invisiblilityscript> ().invisActive || GetComponent<Invisiblilityscript> ().onCooldown) { GetComponent<Invisiblilityscript>().invisActive = false; GetComponent<Invisiblilityscript>().onCooldown = false; GetComponent<Invisiblilityscript>().cooldown = GetComponent<Invisiblilityscript>().fullCooldown; GetComponent<Invisiblilityscript>().duration = GetComponent<Invisiblilityscript>().fullDuration; } //if (method == TYPE_DEATH.MELEE) //this.GetComponent<Invisiblilityscript> ().SetExposure (0); if (method == TYPE_DEATH.TRAP) GetComponentInChildren<ParticleSystem> ().startColor = Color.green; else GetComponentInChildren<ParticleSystem> ().startColor = Color.red; GetComponentInChildren<ParticleSystem> ().Play (); if (SFXVolume != null) SFXVolume.Play (); GetComponent<Invisiblilityscript> ().cooldown = 0.0f; GetComponentInChildren<GrappleHookScript> ().shot = false; //GetComponent<Transform> ().position = new Vector3 (20.0f, 20.0f, 0.0f); lives--; //StartCoroutine (PlayerDeadRespawn()); if (lives == 0) { if(Application.loadedLevelName == "tutorial") Application.LoadLevel("tutorial"); else Application.LoadLevel ("ContinuePage"); lives = 3; } else { if (hiddenDoor != null) hiddenDoor.GetComponent<HiddenDoorScript> ().DeactivateHiding (); transform.position = mainSpawn.transform.position; } }