コード例 #1
0
ファイル: BulletBehavior.cs プロジェクト: BenJester/Supercold
 void OnHit(Thing thing)
 {
     thing.TakeDamage(damage, owner);
     if (gainBuff != null)
     {
         thing.AddBuff(Instantiate(gainBuff));
     }
     Destroy(gameObject);
 }
コード例 #2
0
 void Do()
 {
     Collider2D[] cols = Physics2D.OverlapCircleAll(transform.position, radius, layerMask);
     foreach (Collider2D col in cols)
     {
         Thing thing = col.GetComponent <Thing>();
         if (thing != null && thing.team != owner.team)
         {
             thing.TakeDamage(damage, owner);
             if (buff != null)
             {
                 thing.AddBuff(Instantiate(buff));
             }
         }
     }
     Destroy(gameObject);
 }
コード例 #3
0
 void Scan()
 {
     Collider2D[] cols = Physics2D.OverlapCircleAll(owner.transform.position, owner.col.radius * 4f, Utility.Instance.thingLayer);
     foreach (Collider2D col in cols)
     {
         Thing thing = col.GetComponent <Thing>();
         if (thing != null && thing.team != owner.team && !hitList.Contains(thing))
         {
             thing.TakeDamage(damage, owner);
             if (gainBuff != null)
             {
                 thing.AddBuff(Instantiate(gainBuff));
             }
             hitList.Add(thing);
         }
     }
 }