Beispiel #1
0
    // 设置模块指针(继承自sdBehaviourEvent)aa
    public override void SetBehaviourAdvancedState(sdBehaviourAdvancedState kBehaviourAdvancedState)
    {
        base.SetBehaviourAdvancedState(kBehaviourAdvancedState);

        foreach (sdBehaviourEvent kBehaviourEvent in mBehaviourEventList)
        {
            kBehaviourEvent.SetBehaviourAdvancedState(kBehaviourAdvancedState);
        }

        foreach (sdBehaviourEventNode kBehaviourEventNode in mChildBehaviourEventNodeList)
        {
            kBehaviourEventNode.SetBehaviourAdvancedState(kBehaviourAdvancedState);
        }
    }
Beispiel #2
0
    // 设置模块指针aa
    public virtual void SetBehaviourAdvancedState(sdBehaviourAdvancedState kBehaviourAdvancedState)
    {
        mBehaviourAdvancedState = kBehaviourAdvancedState;

        foreach (sdBehaviourAction kBehaviourAction in mBehaviourActionList)
        {
            kBehaviourAction.BehaviourAdvancedState = kBehaviourAdvancedState;
        }

        foreach (sdBehaviourState kBehaviourState in mBehaviourStateList)
        {
            kBehaviourState.BehaviourAdvancedState = kBehaviourAdvancedState;
        }
    }
    // 更新最近的敌方的距离(这里的距离是到对方边缘的距离)aa
    public float UpdateDistanceOfNearestEnemy(sdBehaviourAdvancedState kBehaviourAdvancedState)
    {
        if (Time.time - mDistanceOfNearestEnemyUpdateTime > 1.0f)
        {
            float fSkillDistance = float.MaxValue;

            MonsterAutoFight kMonsterAutoFight = kBehaviourAdvancedState.MonsterAutoFightComponent;
            sdActorInterface kActor            = kMonsterAutoFight.Monster;
            sdActorInterface kTarget           = kMonsterAutoFight.GetAttackTarget();
            if (kActor != null && kTarget != null)
            {
                fSkillDistance = kMonsterAutoFight.CalcSkillDistance(kActor, kTarget);
            }

            mDistanceOfNearestEnemyUpdateTime = Time.time;
            mDistanceOfNearestEnemy           = fSkillDistance;
        }

        return(mDistanceOfNearestEnemy);
    }