Example #1
0
    public virtual void OnAttachEntity(Entity target)
    {
        WeaponBase[] weapons = target.GetComponentsInChildren<WeaponBase>();
        GameObject effectTmp;

        if (this.weaponEffect == null)
            return;
        foreach (WeaponBase weapon in weapons)
        {
            effectTmp = GameObject.Instantiate(this.weaponEffect) as GameObject;

            if (weapon.mesh != null)
            {
                effectTmp.transform.parent = weapon.mesh.transform;
                effectTmp.transform.localPosition = Vector3.zero;
                effectTmp.transform.localRotation = Quaternion.identity;
                effectTmp.transform.localScale = Vector3.one;
                this._weaponEffectActif.Add(effectTmp);
            }
        }
    }
Example #2
0
    public override void ApplyEntityEffect(Entity target)
    {
        ElementalDoT[] dotElem = target.GetComponentsInChildren<ElementalDoT>();

        if (dotElem != null &&
            dotElem.Length != 0)
        {
            for (int i = 0, size = dotElem.Length; i < size; ++i)
            {
                if (dotElem[i].element == this.dotPrefab.element)
                {
                    dotElem[i].ResetTimer();
                    return;
                }
            }
        }
        GameObject dot = GameObject.Instantiate(this.dotPrefab.gameObject) as GameObject;

        dot.transform.parent = target.transform;
        dot.transform.localPosition = Vector3.zero;
        dot.transform.localRotation = Quaternion.identity;
        dot.transform.localScale = Vector3.one;
        dot.GetComponent<ElementalDoT>().entity = target;
    }