Ejemplo n.º 1
0
    protected virtual void Hit(GameObject hit)
    {
        PlayerHealthAndDeathManager healthManager = hit.gameObject.GetComponent <PlayerHealthAndDeathManager>();

        if (healthManager != null)
        {
            healthManager.DamagePlayer(damage);
        }
        Destroy(gameObject);
    }
Ejemplo n.º 2
0
 // Attack will happen once per frame
 void Update()
 {
     timer += Time.deltaTime;
     if ((isPlayerRange == true) && (timer >= timeBetweenAttacks))
     {
         AttackPlayer(); // Call attack function to damage the player
     }
     if (playerHealth == null)
     {
         playerHealth  = PlayerController.singleton.gameObject.GetComponent <PlayerHealthAndDeathManager>();
         isPlayerRange = false;
     }
 }
Ejemplo n.º 3
0
 void Start()
 {
     player       = PlayerController.singleton.gameObject;
     playerHealth = player.GetComponent <PlayerHealthAndDeathManager>();
 }