Ejemplo n.º 1
0
 // Use this for initialization
 void Awake()
 {
     rb           = GetComponent <Rigidbody2D>();
     state        = GetComponent <EnemyState>();
     enemy        = GetComponent <EnemyBehavior>();
     animator     = GetComponent <Animator>();
     attack       = GetComponent <EnemyAttak>();
     origin       = transform.position;
     initialSpeed = speed;
     debugColor   = Color.red;
 }
Ejemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     enemyAttak = GetComponentInParent <EnemyAttak>();
     if (collision.gameObject.CompareTag("Player") && enemyAttak.attaking)
     {
         Player player = collision.gameObject.GetComponent <Player>();
         attaked = true;
         StartCoroutine(DamageReset());
         // only call DamageCharacter on the player if we don't currently have a DamageCharacter() Coroutine running.
         if (damageCoroutine == null)
         {
             damageCoroutine = StartCoroutine(player.DamageCharacter(damageStrength, 0, this.transform.position));
         }
     }
 }
Ejemplo n.º 3
0
 private void Start()
 {
     enemyAttak = GetComponentInParent <EnemyAttak>();
 }