Ejemplo n.º 1
0
        public void ThrowBomb(CharacterLogic pHost, AttackBombData pData, bool is_foucs)   //is_foucs 为camera是否跟踪
        {
            SkillINstructionData self_skill = GameGOW.Get().DataMgr.GetSkillINstructionDataByID(SkillManager.CurrentSkillId == 0?0:100 + SkillManager.CurrentSkillId);

            pData.damage        = self_skill.damage;
            pData.center_damage = self_skill.center_damage;
            BombData pBombData = GameGOW.Get().DataMgr.GetBombDataByID(pData.bomb_config_id);

            if (pBombData != null)
            {
                int uid;
                lock (locker)
                {
                    uid = GameGOW.Get().GetNextUid();
                }
                //   Debug.Log("EEEEEEEEEEEEEEEEEEEEEEE-------------UID"+uid);
                BaseBomb m_stBombLogic = ObjectPools.CheckOut <BaseBomb>(uid, pHost, pBombData, pData);
                //  Debug.Log("EEEEEEEEEEEEEEEEEEEEEEE-------------UID" + m_stBombLogic.Config.m_iResourceID);
                m_stBombLogic.Position = pHost.GetWeaponPosition();
                float radian;
                if (SkillManager.CurrentSkillId == (int)SkillManager.SkillType.Rocket)
                {
                    radian = MathUtil.AngleToRadian(pHost.GetFireAngle()) * pHost.m_pInfo.m_iFacing;
                    GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iFireAngle = SkillManager.PreAngle;
                }
                else
                {
                    radian = MathUtil.AngleToRadian(pHost.GetFireAngle() + pHost.CalcObjectAngle()) * pHost.m_pInfo.m_iFacing;
                }

                float speedX = pHost.m_pInfo.m_iBombSpeed * Mathf.Cos(radian) * pHost.m_pInfo.m_iFacing;
                float speedY = pHost.m_pInfo.m_iBombSpeed * Mathf.Sin(radian);

                m_stBombLogic.Start();
                if (SkillManager.thunder_bomb_num > 0)
                {
                    speedX = 0.0f;
                    speedY = 0.0f;

                    float val = GameGOW.Get().MapMgr.m_stBound.xMax - GameGOW.Get().MapMgr.m_stBound.xMin;
                    float add = val / 6;
                    m_stBombLogic.Position = new Vector2(GameGOW.Get().MapMgr.m_stBound.xMin + add * SkillManager.thunder_bomb_num, GameGOW.Get().MapMgr.m_stBound.yMax - 10);
                }
                m_stBombLogic.SetSpeedXY(speedX, speedY);
                m_dicBombs[uid] = m_stBombLogic;

                if (OnBombNew != null)
                {
                    OnBombNew(m_stBombLogic, is_foucs);
                }
            }
        }
Ejemplo n.º 2
0
 public CharacterLogic CreateCharacter(int uid, CharacterInstructionData pData)
 {
     if (m_dicCharacterLogic.ContainsKey(uid))
     {
         return(m_dicCharacterLogic[uid]);
     }
     else
     {
         CharacterLogic pRet = ObjectPools.CheckOut <CharacterLogic>((int)uid, pData);
         m_dicCharacterLogic[uid] = pRet;
         if (OnCharacterNew != null)
         {
             OnCharacterNew(pRet);
         }
         return(pRet);
     }
 }
Ejemplo n.º 3
0
 public void OnFunctionKeyDown(int uiKey)
 {
     switch (uiKey)
     {
     case InputDefine.ATTACK:
         if (m_pInfo.m_bIsInRound)
         {
             if (m_pInfo.m_bInBombSpeedUp == false)
             {
                 m_pInfo.m_bInBombSpeedUp = true;
                 m_pInfo.m_iBombSpeed     = 0;
                 Act(ObjectPools.CheckOut <CharacterAttackAction>(this));
             }
         }
         break;
     }
 }
Ejemplo n.º 4
0
        public void OnDirectionKeyChanged(int uiKey)
        {
            if (m_pInfo.m_iDirectionKeys != uiKey)
            {
                m_pInfo.m_iDirectionKeys = uiKey;
                //朝向
                if ((m_pInfo.m_iDirectionKeys & InputDefine.MOVE_RIGHT) != 0)
                {
                    m_pInfo.m_iFacing = GameDefine.FACING_RIGHT;
                }
                else if ((m_pInfo.m_iDirectionKeys & InputDefine.MOVE_LEFT) != 0)
                {
                    m_pInfo.m_iFacing = GameDefine.FACING_LEFT;
                }

                //移动
                Act(ObjectPools.CheckOut <SelfCharacterWalkAction>(this));
            }
        }
Ejemplo n.º 5
0
        public override void Execute()
        {
            /*
             * bool flag = true, living = false;
             * int startx = (int)m_pCharacter.Position.x;
             * int endx = startx + ((int)m_pCharacter.m_pInfo.m_iFacing) * (m_pCharacter.m_pInfo.m_pInstructionData.be_attack_box_max_x - m_pCharacter.m_pInfo.m_pInstructionData.be_attack_box_min_x) / 2;
             * int nowx = startx;
             * int stepx = endx > nowx ? 1 : -1;
             * MapManager pMap = GameGOW.Get().MapMgr;
             * Vector2 p1 = Vector2.zero;
             * do
             * {
             *  Vector2 p = pMap.FindYLineNotEmptyPointUp(nowx, (int)m_pCharacter.Position.y + m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_y,
             *      (int)pMap.m_stBound.height);
             *  if (m_pCharacter.Position == p) flag = false;
             *  if (p != Vector2.zero) living = true;
             *  if (nowx == startx) p1 = p;
             *  nowx = nowx + stepx;
             * } while (nowx != endx);
             * if (flag)
             * {
             *  if (living)
             *  {
             *      BaseAction act = ObjectPools.CheckOut<CharacterFallingAction>(m_pCharacter, p1, true, false);
             *      m_pCharacter.Act(act);
             *  }
             *  else
             *  {
             *      p1 = new Vector2(startx, pMap.m_stBound.yMin);
             *      BaseAction act = ObjectPools.CheckOut<CharacterFallingAction>(m_pCharacter, p1, false, false);
             *      m_pCharacter.Act(act);
             *  }
             * }
             */

            int        tx   = (int)m_pCharacter.Position.x;
            MapManager pMap = GameGOW.Get().MapMgr;
            Vector2    p    = pMap.FindYLineNotEmptyPointUp_(tx, (int)m_pCharacter.Position.y + m_pCharacter.m_pInfo.m_pInstructionData.walk_speed_y,
                                                             (int)pMap.m_stBound.height);

            // Debug.Log("xxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"+p.x+"-"+p.y+"-----"+GameGOW.Get().MapMgr.IsEmpty((int)p.x,(int)p.y)+" "+ GameGOW.Get().MapMgr.IsEmpty((int)p.x-3, (int)p.y)+"  "+ GameGOW.Get().MapMgr.IsEmpty((int)p.x+3, (int)p.y));
            //for(int i=0;i)
            //   p.x -= 3;

            if (m_pCharacter.Position != p)
            {
                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.Act(act);
                }
            }

            _isFinished = true;
        }
Ejemplo n.º 6
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();
                }
            }
        }
Ejemplo n.º 7
0
 public void Falling()
 {
     Act(ObjectPools.CheckOut <CharacterCheckFallingAction>(this));
 }