Ejemplo n.º 1
0
	// Update is called once per frame
	void Update () 
	{
		//start timers
		timer -= Time.deltaTime;
		lifeTimer -= Time.deltaTime;
		damageTimer -= Time.deltaTime;

		if (playerClose && damageTimer <= 0)
		{
			//damage player
			ps.DamagePlayer (damage);

			//reset timer
			damageTimer = 0.5f;
		}
		//if timer <= 0
		if (timer <= 0f)
		{
			//move geyser to geyser hight
			transform.position = Vector3.Lerp (transform.position, geyserHeight.position, 1 * Time.deltaTime);
		}

		//if life timer <= 0
		if (lifeTimer <= 0f)
		{
			// destroy geyser
			Destroy (this.gameObject);
		}
	}
 void OnTriggerEnter(Collider other)
 {
     //if it hits the player
     if (other.gameObject == Player_Script.playerObj)
     {
         //damage player
         ps.DamagePlayer(damage);
     }
 }