Beispiel #1
0
 private void Update()
 {
     if (player != null && (DateTime.Now - lastEncounter).TotalSeconds > timeDelay)
     {
         player.TakeDamageFromTraps(-damage);
         lastEncounter = DateTime.Now;
     }
 }
Beispiel #2
0
    private void OnTriggerEnter2D(Collider2D info)
    {
        if ((DateTime.Now - lastEncounter).TotalSeconds < 0.1f)
        {
            return;
        }

        lastEncounter = DateTime.Now;
        player        = info.GetComponent <Player_controller>();
        if (player != null)
        {
            player.TakeDamageFromTraps(-damage);
        }
    }