Advertisement
iFrenzo

Untitled

Nov 19th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Damage : MonoBehaviour {
  6.    
  7.     public Health health;
  8.     public float uron;
  9.     public float AttacTime; // Период между атаками
  10.     private float t; // второстипенная переменная необходимая для выполнения логики
  11.  
  12.     void OnTriggerStay (Collider other) {  
  13.         if (other.CompareTag ("Player")) {  
  14.         //if (other.GetComponent ("MalePlayer_Photon")) {
  15.             //Debug.Log ("ПЛЕЕР");
  16.             health = GetComponent <Health> ();
  17.             if (Time.time - t > AttacTime)
  18.             {
  19.                 //Debug.Log ("ПЛЕЕР2");
  20.                 health.Takedamage (uron);
  21.             }
  22.         }
  23.     }  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement