Exemplo n.º 1
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.tag == Tags.enemy)
     {
         WolfBaby baby = other.GetComponent <WolfBaby>();
         if (!wolfList.Contains(baby))
         {
             baby.TakeDamage(attack);
             wolfList.Add(baby);
         }
     }
 }
 public void OnTriggerEnter(Collider col)
 {
     if (col.tag == Tags.enemy)
     {
         WolfBaby baby  = col.GetComponent <WolfBaby>();
         int      index = wolfList.IndexOf(baby);
         if (index == -1)
         {
             baby.TakeDamage((int)attack);
             wolfList.Add(baby);
         }
     }
 }
Exemplo n.º 3
0
 public void OnTriggerEnter(Collider col)
 {
     if (col.tag == Tags.Enemy.ToString())
     {
         WolfBaby wolf  = col.GetComponent <WolfBaby>();
         int      index = wolfList.IndexOf(wolf);
         if (index == -1)
         {
             wolf.TakeDamage(attack);
             wolfList.Add(wolf);
         }
     }
 }
Exemplo n.º 4
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag.Equals("enemy"))
     {
         WolfBaby baby  = col.GetComponent <WolfBaby> ();
         int      index = wolflist.IndexOf(baby);
         if (index == -1)
         {
             baby.TakeDamage((int)attack);
             wolflist.Add(baby);
         }
     }
 }
Exemplo n.º 5
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == Tags.enemy)
     {
         GameObject go    = other.gameObject;
         WolfBaby   wolf  = go.GetComponent <WolfBaby>();
         int        index = wolfList.IndexOf(wolf);
         if (index == -1)
         {
             wolf.TakeDamage((int)attack);
             wolfList.Add(wolf);
         }
     }
 }
Exemplo n.º 6
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.tag == Tags.Enemy)
     {
         //对单个敌人只触发一次伤害
         WolfBaby baby  = other.GetComponent <WolfBaby>();
         int      index = wolfList.IndexOf(baby);
         if (index == -1)
         {
             baby.TakeDamage(PlayerStatus._instance.sum_attack * 4);
             wolfList.Add(baby);
         }
     }
 }
 void Start()
 {
     wolfBaby = this.GetComponent <WolfBaby>();
     //获取放HP血条的父物体( Canvas )
     HP_Parent = GameObject.FindWithTag("HP").transform;
     //把游戏物体的世界坐标转换为屏幕坐标
     EnemySceenPosition = Camera.main.WorldToScreenPoint(transform.position);
     //创建一个Clone血条图片
     HpPrefab_new = Instantiate(HpPrefab, EnemySceenPosition, Quaternion.identity);
     //设置血条的父物体
     HpPrefab_new.transform.SetParent(HP_Parent);
     slider   = HpPrefab_new.GetComponentInChildren <Slider>();
     text     = HpPrefab_new.GetComponentInChildren <Text>();
     director = HpPrefab_new.GetComponentInChildren <PlayableDirector>();
 }