public override void Entered(object param)
        {
            mUsed = false;
            BattleInstructionBase instruction = param as BattleInstructionBase;

            switch (instruction.InstructionType)
            {
            case BattleInstructionType.AreaTargetSkill:
                BattleAreaTargetSkill targetSkillIns = instruction as BattleAreaTargetSkill;
                mSkillId     = targetSkillIns.SkillId;
                mSkillAngle  = targetSkillIns.SkillAngle;
                mSkillParam1 = targetSkillIns.SkillParam1;
                break;

            case BattleInstructionType.NoTargetSkill:
                BattleNoTargetSkill noTargetSkillIns = instruction as BattleNoTargetSkill;
                mSkillId = noTargetSkillIns.SkillId;
                break;

            case BattleInstructionType.UnitTargetSkill:
                BattleUnitTargetSkill unitTargetSkillIns = instruction as BattleUnitTargetSkill;
                mSkillId           = unitTargetSkillIns.SkillId;
                mSkillTargetUnitId = unitTargetSkillIns.TargetUnitId;
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
 public bool PlayerBattleInstruction(int playerId, BattleInstructionBase instruction)
 {
     //不相信客户端,万一有外挂能让别人使用技能呢
     instruction.SceneUnitId = playerId;
     mPlayerBattleInstructionList.Add(instruction);
     return(true);
 }
Exemplo n.º 3
0
            public void SetBattleInstruction(BattleInstructionBase instruction)
            {
                UnitBase battleUnit = GetUnitByUnitId(instruction.SceneUnitId);

                if (null != battleUnit)
                {
                    battleUnit.SetBattleInstruction(instruction);
                }
            }
Exemplo n.º 4
0
        public bool PlayerBattleInstruction(int playerId, BattleInstructionBase instruction)
        {
            LBScene scene = GetSceneByPlayerId(playerId);

            if (scene == null)
            {
                LBLogger.Error(LogTag, "收到玩家的战斗指令,但是没有找到对应的场景 " + playerId);
                return(false);
            }
            return(scene.PlayerBattleInstruction(playerId, instruction));
        }
Exemplo n.º 5
0
        public static void OnOperateRequest(MyPeer peer, OperationRequest operationRequest)
        {
            LBPlayer curPlayer = LBPlayerManager.Instance.GetPlayerByConnectionId(peer.ConnectionId);

            if (curPlayer == null)
            {
                //LBLogger.Error("RqBattleInstructionHandler", "玩家没有登录");
                return;
            }
            byte[] byteArray = RqBattleInstruction.Deserialization(operationRequest.Parameters);
            int    index     = 0;
            BattleInstructionBase battleInstruction = BattleInstructionBase.Deserializetion(byteArray, ref index);

            if (null == battleInstruction)
            {
                LBLogger.Error("RqBattleInstructionHandler", "消息解析失败");
                return;
            }
            LBSceneManager.Instance.PlayerBattleInstruction(curPlayer.PlayerId, battleInstruction);
        }
Exemplo n.º 6
0
            public void SetBattleInstruction(BattleInstructionBase instruction)
            {
                switch (instruction.InstructionType)
                {
                case BattleInstructionType.Move:
                    Enter((int)UnitAIStateType.InstructionMove, instruction);
                    break;

                case BattleInstructionType.StopMove:
                    Enter((int)UnitAIStateType.Idle, instruction);
                    break;

                case BattleInstructionType.AreaTargetSkill:
                case BattleInstructionType.NoTargetSkill:
                case BattleInstructionType.UnitTargetSkill:
                    Enter((int)UnitAIStateType.InstructionSkill, instruction);
                    break;

                default:
                    break;
                }
            }
Exemplo n.º 7
0
        void PlayOneFrame()
        {
            CurFrameCount++;
            OneFrameInstructions instructions = BattleInstructionManager.Instance.GetFrameInstructions();

            if (null == instructions)
            {
                return;
            }
            //Logger.LogWarning ("取得指令: " + instructions.frameCount);
            Utils.Assert(instructions.frameCount == CurFrameCount, "战斗需要第" + CurFrameCount + "但是确拿到了第" + instructions.frameCount + "帧的指令");
            BattleUnitManager unitManager = BattleUnitManager.Instance;

            for (int i = 0; i < instructions.instructionList.Count; ++i)
            {
                BattleInstructionBase instruction = instructions.instructionList [i];
                unitManager.SetBattleInstruction(instruction);
            }

            BattleUnitManager.Instance.Update();
            BattleActorManager.Instance.Update();
            SkillEffectManager.Instance.Update();
        }
Exemplo n.º 8
0
 public void SetBattleInstruction(BattleInstructionBase instruction)
 {
     mAI.SetBattleInstruction(instruction);
 }