Пример #1
0
    public override void Attack(GameObject source, Vector3 contactPoint, float AttackArg1, float AttackArg2, float AttackArg3, float AttackArg4, Collider collider, GameObject effect, GameObject effect2)
    {
        //float Damage, float timeInterval, float damageDecreasePercent, float radius

        Collider[] colliders = Physics.OverlapSphere(contactPoint, AttackArg4);

        try{
            foreach (Collider hit in colliders)
            {
                IPoisonable poisonableObject = hit.GetComponent <IPoisonable>();

                if (poisonableObject != null)
                {
                    poisonableObject.TakePoison(AttackArg1, AttackArg2, AttackArg3, contactPoint, effect);
                }
                else if (string.Compare(hit.tag, "Enemy") == 0)
                {
                    IPoisonable poisonableObject2 = hit.transform.parent.parent.parent.parent.GetComponent <IPoisonable>();
                    if (poisonableObject2 != null)
                    {
                        poisonableObject2.TakePoison(AttackArg1, AttackArg2, AttackArg3, contactPoint, effect);
                    }
                }
            }
        }catch (NullReferenceException e) {}


        //Destroy(Instantiate(effect.gameObject, source.transform.position + 0.2f*Vector3.up, Quaternion.identity) as GameObject, 3f);

        //Destroy(source);
        source.SetActive(false);
    }
Пример #2
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger.
    /// </summary>
    /// <param name="other">The other Collider involved in this collision.</param>
    void OnTriggerEnter(Collider other)
    {
        IHittable badGuy = other.GetComponent <IHittable>();

        if (badGuy != null && other.gameObject.name == target.gameObject.name)
        {
            badGuy.TakeDamage(damage, damageType);
        }
        IPoisonable creep = other.GetComponent <IPoisonable>();

        if (creep != null && other.gameObject.name == target.gameObject.name)
        {
            creep.BePoisoned(poisonDamage, poisonTicks);
            Destroy(gameObject);
        }
    }
Пример #3
0
 public static PoisonLevel ReadPoisonLevel(this IPoisonable obj, List <ClilocItemRec> reader)
 {
     return
         ((from PoisonLevel x in Enum.GetValues(typeof(PoisonLevel)) where !x.Equals(PoisonLevel.None) select x)
          .FirstOrDefault(x => ClilocHelper.Contains(reader, (uint)x)));
 }