Ejemplo n.º 1
0
    /// <summary>
    /// 给单位添加特效.
    /// </summary>
    public static void AddEffect2Object(BattleUnit owner, uint effectID, string bindpoint, float dir = float.NaN, bool loop = false, ClientBehaviourIdContainer cont = null)
    {
        uint runtimeID = uint.MaxValue;

        if (effectID != uint.MaxValue)
        {
            runtimeID = owner.AddEffect(effectID, bindpoint, dir);
            if (runtimeID == uint.MaxValue)
            {
                ErrorHandler.Parse(ErrorCode.ConfigError, "添加特效" + effectID + "失败");
            }
        }

        EffectTableItem eti = DataManager.EffectTable[effectID] as EffectTableItem;


        if (eti != null && eti.loop && cont != null)
        {
            if (cont.threeDEffect2Role_0 == uint.MaxValue)
            {
                cont.threeDEffect2Role_0 = runtimeID;
            }
            else
            {
                cont.threeDEffect2Role_1 = runtimeID;
            }
        }
    }
Ejemplo n.º 2
0
    override public void OnSpriteModelLoaded(uint instanceid)
    {
        base.OnSpriteModelLoaded(instanceid);

        BattleUnit unit = FindObject(instanceid) as BattleUnit;

        if (unit == null)
        {
            return;
        }

        if (PlayerController.Instance.GetMainCropsControl() == instanceid ||
            PlayerController.Instance.GetSubCropsControl() == instanceid ||
            PlayerController.Instance.GetControl() == instanceid)
        {
            unit.AddEffect(528, null);
            unit.AddSkillEffect(new AttackerAttr(unit), SkillEffectType.Buff, GameConfig.PvpBuffId);
        }
        else
        {
            Ghost ghost = unit as Ghost;
            if (ghost == null)
            {
                return;
            }

            mGhost = ghost;
            ghost.AddSkillEffect(new AttackerAttr(ghost), SkillEffectType.Buff, GameConfig.PvpBuffId);
        }
    }