// Use this for initialization void Start() { _targetType = LFTargetType.random; _targetPosition = transform.position; _anim = gameObject.GetComponent <Animator> (); UpdatePath(); }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "tPlayer") { _targetType = LFTargetType.player; _player = other.gameObject.transform; _targetPosition = other.gameObject.transform.position; UpdateSprite(); _anim.Play("Attack"); gameObject.GetComponent <AudioSource>().Play(); /*GameObject blood = Instantiate(bloodPrefab, _targetPosition, Quaternion.identity); * blood.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); * StartCoroutine (GameOver ());*/ GetComponent <AudioSource> ().PlayOneShot(sounds[0]); other.gameObject.transform.parent.gameObject.GetComponent <LFPlayer> ().Hit(damage); } }