Пример #1
0
        override public void Execute()
        {
            if (Network.NetworkMode == false)
            {
                if (m_pCharacter.m_pInfo.m_iDirectionKeys != 0 && //方向键已经按下
                    m_pCharacter.m_pInfo.m_iMoveEnergy > 0 &&     //还有移动能量
                    m_pCharacter.m_pInfo.m_bIsInRound
                    )
                {
                    Vector2 p = m_pCharacter.GetNextWalkPoint(m_pCharacter.m_pInfo.m_iFacing);
                    if (p != Vector2.zero)
                    {
                        --m_pCharacter.m_pInfo.m_iMoveEnergy;
                        m_pCharacter.Position = p;
                        m_pCharacter.Body.DoAction(CharacterStateType.WALK);
                        m_iCount++;
                        if (m_iCount >= SEND_MSG_COUNT)
                        {
                            SendAction();
                        }
                    }
                    else
                    {
                        SendAction();
                        Finish();
                        int tx = (int)m_pCharacter.Position.x + m_pCharacter.m_pInfo.m_iFacing * m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_x;
                        if (m_pCharacter.CanMoveDirection(m_pCharacter.m_pInfo.m_iFacing) && m_pCharacter.CanStand(tx, (int)m_pCharacter.Position.y) == false)
                        {
                            MapManager pMap = GameGOW.Get().MapMgr;
                            p = pMap.FindYLineNotEmptyPointUp(tx, (int)m_pCharacter.Position.y + m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_y,
                                                              (int)pMap.m_stBound.height);
                            if (p != Vector2.zero)
                            {
                                BaseAction act = ObjectPools.CheckOut <CharacterFallingAction>(m_pCharacter, p, true, false);
                                m_pCharacter.Act(act);
                            }
                            else
                            {
                                p = new Vector2(tx, pMap.m_stBound.yMin);


                                BaseAction act = ObjectPools.CheckOut <CharacterFallingAction>(m_pCharacter, p, false, false);
                                m_pCharacter.go_down = true;
                                m_pCharacter.Act(act);
                            }
                        }
                    }
                }
                else
                {
                    if (m_pCharacter.m_pInfo.m_iMoveEnergy <= 0)
                    {
                    }
                    SendAction();
                    Finish();
                }
            }
            else
            {
                if (m_pCharacter.m_pInfo.m_iDirectionKeys != 0 && //方向键已经按下
                    m_pCharacter.m_pInfo.m_iMoveEnergy > 0        //还有移动能量
                    )
                {
                    Vector2 p = m_pCharacter.GetNextWalkPoint(m_pCharacter.m_pInfo.m_iFacing);
                    if (p != Vector2.zero)
                    {
                        --m_pCharacter.m_pInfo.m_iMoveEnergy;
                        m_pCharacter.Position = p;
                        m_pCharacter.Body.DoAction(CharacterStateType.WALK);
                        m_iCount++;
                        if (m_iCount >= SEND_MSG_COUNT)
                        {
                            SendAction();
                        }
                    }
                    else if (Network.gamemode != BattleType.AI_1v1 || GameGOW.Get().BattleMgr.m_pCurrentPlayer.ID == Network.playerid)
                    {
                        SendAction();
                        Finish();
                        int tx = (int)m_pCharacter.Position.x + m_pCharacter.m_pInfo.m_iFacing * m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_x;
                        if (m_pCharacter.CanMoveDirection(m_pCharacter.m_pInfo.m_iFacing) && m_pCharacter.CanStand(tx, (int)m_pCharacter.Position.y) == false)
                        {
                            MapManager pMap = GameGOW.Get().MapMgr;
                            p = pMap.FindYLineNotEmptyPointUp(tx, (int)m_pCharacter.Position.y + m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_y,
                                                              (int)pMap.m_stBound.height);
                            if (p != Vector2.zero)
                            {
                                BaseAction act = ObjectPools.CheckOut <CharacterFallingAction>(m_pCharacter, p, true, false);
                                m_pCharacter.Act(act);
                            }
                            else
                            {
                                p = new Vector2(tx, pMap.m_stBound.yMin);
                                BaseAction act = ObjectPools.CheckOut <CharacterFallingAction>(m_pCharacter, p, false, false);
                                m_pCharacter.go_down = true;
                                m_pCharacter.Act(act);
                            }
                        }
                    }
                }
                else
                {
                    if (m_pCharacter.m_pInfo.m_iMoveEnergy <= 0)
                    {
                    }
                    SendAction();
                    Finish();
                }
            }
        }
Пример #2
0
 virtual public void RemoveFromMap()
 {
     _map = null;
 }