Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class wallScipt : MonoBehaviour {
- public int hp = 15;
- float damageTick = 0f;
- public float damageInter = 0.4f;
- public GameObject self;
- public GameObject theUnitM;
- public void OnTriggerStay(Collider other)
- {
- if (other.tag == "emu")
- {
- damageTick += Time.deltaTime;
- if (damageTick > damageInter)
- {
- hp -= 1;
- if (hp < 1)
- {
- other.GetComponent<emuScript>().Move();
- theUnitM.GetComponent<unitManager>().UpdateGrid(self.transform.position);
- Destroy(self);
- }
- damageTick = 0f;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement