Esempio n. 1
0
 // 检查是否进入自动战斗处理aa
 protected virtual bool IsNeedUpdate()
 {
     if (mEnable == false)
     {
         return(false);                      //< 自动战斗被禁用aa
     }
     if (mActor == null)
     {
         return(false);                      //< 角色被清除aa
     }
     if (mActor.GetCurrentHP() <= 0)
     {
         return(false);                      //< 角色已死亡aa
     }
     if (mActor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STUN))
     {
         return(false);                      //< 角色进入昏迷状态aa
     }
     return(true);
 }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (actor != null)
        {
            foreach (DictionaryEntry e in actor.Property)
            {
                sdConfDataMgr.SetMemberValue(this, e.Key as string, e.Value);
            }
        }

        {
            List <sdBuff> lstBuff = actor.GetBuffs();
            if (lstBuff.Count > 0)
            {
                Hashtable table = (Hashtable)sdConfDataMgr.Instance().GetTable("buff");
                if (buff == null)
                {
                    buff = new string[lstBuff.Count];
                }
                if (buff.Length != lstBuff.Count)
                {
                    buff = new string[lstBuff.Count];
                }
                for (int i = 0; i < lstBuff.Count; i++)
                {
                    sdBuff    sbuff = lstBuff[i];
                    int       id    = sbuff.GetTemplateID();
                    Hashtable prop  = table[id.ToString()] as Hashtable;

                    buff[i] = id.ToString() + "_" +
                              prop["szName[ROLE_NAME_LEN]"] as string + "_" +
                              prop["szDescription[DESCRIPTION_LEN]"] as string;
                }
            }
            else
            {
                buff = null;
            }
        }

        STAY        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STAY);
        HOLD        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_HOLD);
        STUN        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STUN);
        LIMIT_SKILL = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL);
        UNBEAT      = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_UNBEAT);
        KNOCKBACK   = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_KNOCKBACK);
    }
Esempio n. 3
0
    // 更新aa
    public void UpdateSelf()
    {
        if (statePointer != null)
        {
            statePointer.Update(_gameActor);
            if (_gameActor.GetCurrentHP() <= 0)
            {
                nextState = null;
                if (statePointer != die)
                {
                    SwitchSkill(_gameActor, null);
                    SwitchToState(_gameActor, die);
                }
                return;
            }
            else if (_gameActor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STUN) ||
                     _gameActor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_HOLD))
            {
                nextState = null;
                sdBaseState switchState = stun;
                if (stun == null)
                {
                    switchState = idle;
                }
                if (statePointer != switchState)
                {
                    SwitchSkill(_gameActor, null);
                    SwitchToState(_gameActor, switchState);
                }
                return;
            }
            else if (_gameActor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_IDLE))
            {
                nextState = null;
                sdBaseState switchState = idle;
                if (idle == null)
                {
                    switchState = idle;
                }
                if (statePointer != switchState)
                {
                    SwitchSkill(_gameActor, null);
                    SwitchToState(_gameActor, switchState);
                }
                return;
            }

            if (!statePointer.bPassive)
            {
                if (IsAnimLoop())
                {
                    //判断是否死亡..
                    if (GetCurrentPassiveState() == die)
                    {
                        nextState = null;
                        SwitchToState(_gameActor, die);
                        return;
                    }
                    sdBaseState next = nextState;
                    nextState = null;
                    if (next != null && next != statePointer)
                    {
                        SwitchSkill(_gameActor, next.belongToSkill);
                        SwitchToState(_gameActor, next);
                    }
                }
                else if (IsAnimPlayOver())
                {
                    sdBaseState next = nextState;
                    if (next == null)
                    {
                        next = GetCurrentPassiveState();
                    }
                    nextState = null;

                    SwitchSkill(_gameActor, next.belongToSkill);
                    SwitchToState(_gameActor, next);
                }
                else
                {
                    if (nextState != null)
                    {
                        if (nextState.belongToSkill.id == 1002 && statePointer.bAllHitPointDone)
                        {
                            sdBaseState next = nextState;
                            nextState = null;
                            SwitchSkill(_gameActor, next.belongToSkill);
                            SwitchToState(_gameActor, next);
                        }
                    }
                }
            }
            else
            {
                sdBaseState next = nextState;
                if (next == null)
                {
                    next = GetCurrentPassiveState();
                }
                nextState = null;
                if (statePointer != next)
                {
                    SwitchSkill(_gameActor, next.belongToSkill);
                    SwitchToState(_gameActor, next);
                }
            }
        }
        else
        {
            if (_gameActor.AnimController == null)
            {
                return;
            }
            sdBaseState next = nextState;
            if (next == null)
            {
                next = GetCurrentPassiveState();
            }
            if (!next.IsAnimValid(_gameActor))
            {
                return;
            }
            nextState = null;

            SwitchToState(_gameActor, next);
        }
    }