Esempio n. 1
0
 private void OnTriggerExit2D(Collider2D ExitPlayerName)
 {
     if (player == ExitPlayerName.GetComponent <PlayerStanceController>())
     {
         player = null;
     }
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerStanceController player = collision.GetComponent <PlayerStanceController>();

        if (player != null)
        {
            player.TakeDamage(damage);
            Destroy(gameObject);
        }
        Destroy(gameObject, 2f);
    }
Esempio n. 3
0
 private void OnTriggerEnter2D(Collider2D TriggerPlayerName)
 {
     if ((DateTime.Now - TicTimer).TotalSeconds <= 0.1f)
     {
         return;
     }
     TicTimer = DateTime.Now;
     player   = TriggerPlayerName.GetComponent <PlayerStanceController>();
     if (player != null)
     {
         player.TakeDamage(Damage);
     }
 }
Esempio n. 4
0
    protected virtual void TryToDamage(Collider2D enemy)
    {
        if (Time.time - lastDamageTime < collisionTimeDelay)
        {
            return;
        }
        PlayerStanceController player = enemy.GetComponent <PlayerStanceController>();

        if (player != null)
        {
            player.TakeDamage(collisionDamage, collisionDamageType, transform);
        }
    }
    protected void Strike()
    {
        Collider2D player = Physics2D.OverlapBox(strikePoint.position, new Vector2(strikeRange, strikeRange), 0, enemies);

        if (player != null)
        {
            PlayerStanceController playerStance = player.GetComponent <PlayerStanceController>();
            if (playerStance != null)
            {
                playerStance.TakeDamage(damage);
            }
        }
    }
Esempio n. 6
0
 protected override void Start()
 {
     base.Start();
     player = FindObjectOfType <PlayerStanceController>();
     StartCoroutine(ScanForPlayer());
 }