public void SetData(MapData pData) { m_stBound.Set(pData.bound_left, pData.bound_bottom, pData.bound_right - pData.bound_left, pData.bound_top - pData.bound_bottom); Gravity = pData.gravity; AirResistance = pData.air_resistance; wind_range = pData.wind_range; wind_step = pData.wind_step; for (int i = 0; i < pData.m_listTerrain.Count; ++i) { MapCellData cellData = pData.m_listTerrain[i]; var srcTexture = GameGOW.Get().ResourceMgr.GetRes <Texture2D>(cellData.resource); Texture2D terrain = new Texture2D(srcTexture.width, srcTexture.height); terrain.SetPixels(srcTexture.GetPixels()); terrain.Apply(); //因原图采用了压缩格式,长宽有变化,并非最初设计效果,所以这里对创建的图重新设置长宽(设置为原图的长宽值,值由地形的XML读入) TextureScale.Bilinear(terrain, cellData.Width, cellData.Height); Tile tile = new Tile(cellData.pos_x * 100, cellData.pos_y * 100, terrain); tile.m_bIsDigable = cellData.digable; if (cellData.digable) { m_listTerrains.Add(tile); } else { m_listStones.Add(tile); } if (OnTerrainCellNew != null) { OnTerrainCellNew(terrain, cellData); } } }
public override void Initialize() { base.Initialize(); GameGOW.Get().TickerMgr.AddFixTicker(this); m_dicTeamResult = new Dictionary <int, TeamResult>(); m_dicPlayerResult = new Dictionary <int, PlayerResult>(); }
/// <summary> /// 结束战斗 /// </summary> /// <param name="needCalcResult">是否需要计算结果, 玩家主动退出情况不需要计算结果</param> public void StopBattle(bool needCalcResult = true) { if (needCalcResult) { _CheckFinalBattleResult(); } if (GameGOW.Get().Winner_Id == 2) { SounderManager.Get().PlaySound(1, "sound/win01"); } else { SounderManager.Get().PlaySound(1, "sound/shibai_09"); } RemoveEvents(); m_bIsInBattle = false; m_stBattleInfo = null; m_iCurrentRound = 0; m_iBattleEndTick = (int)GameGOW.Get().TickerMgr.TickCount; EventDispatcher.DispatchEvent("EventBattleStop", this, null); }
public void Throw_thunder_bomb(CharacterLogic A, AttackBaseData AA) { while (--thunder_bomb_num != 0) { GameGOW.Get().BombMgr.ThrowBomb(A, AA as AttackBombData, false); } }
public bool Initialize(object[] args) { base.Initialize(); _id = (int)args[0]; m_pHost = args[1] as CharacterLogic; m_pConfig = args[2] as BombData; AttackBombData pData = args[3] as AttackBombData; m_pAttackInfo.m_pFight = m_pHost; m_pAttackInfo.m_iDamage = pData.damage; m_pAttackInfo.m_iCenterDamage = pData.center_damage; m_stShape = GameGOW.Get().ResourceMgr.GetRes <Texture2D>(m_pConfig.m_strShapePath); m_stBorder = GameGOW.Get().ResourceMgr.GetRes <Texture2D>(m_pConfig.m_strBorderPath); Network.n_stShape = m_stShape; Network.n_stBorder = m_stBorder; _mass = m_pConfig.m_fMass; _gravityFactor = m_pConfig.m_fGFactor; _windFactor = m_pConfig.m_fWindFactor; _airResitFactor = m_pConfig.m_fAirResitFactor; _testRect = m_pConfig.m_pAttackRect; return(true); }
public void set_animation(int x) { cur_boom = "BOOM-1"; if (x < 2) { cur_fly = "FLY-2"; } else if (x < 7) { cur_fly = "FLY-3"; if (x == 6) { cur_boom = "BOOM-2"; } } else if (x == 7) { if (GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iFacing == GameDefine.FACING_RIGHT) { cur_boom = cur_fly = "FLY-4"; } else { cur_boom = cur_fly = "FLY-5"; } } }
override public void ExecuteAtOnce() { base.ExecuteAtOnce(); m_pCharacter.Position = m_pTarget; // _player.needFocus(); if (!m_bIsLiving) { if (m_pCharacter.IsLiving == true) { if (Network.gamemode == BattleType.AI_1v1) { m_pCharacter.Dead(); } else if (Network.NetworkMode == true) { if (Network.playerid == m_pCharacter.ID) { Network.Send_Over(Network.Pid_Tid[m_pCharacter.ID], false); } } else { m_pCharacter.Dead(); } } if (Network.NetworkMode == false) { GameGOW.Get().BattleMgr.ChangeController(); } } Finish(); }
virtual public void AddToMap() { _map = GameGOW.Get().MapMgr; _arf = _map.AirResistance * _airResitFactor; _gf = _map.Gravity * _gravityFactor * _mass; _wf = _map.Wind * _windFactor; }
private void InitPlayerInfo(MapData pMapData) { Dictionary <int, int> m_dicTeamCount = new Dictionary <int, int>(); for (int i = 0; i < m_stBattleInfo.m_listPlayers.Count; ++i) { PlayerInfo playerInfo = m_stBattleInfo.m_listPlayers[i]; CharacterInstructionData pData = GameGOW.Get().DataMgr.GetCharacterInstructionByID(playerInfo.m_iInstructionID); //pData.default_name = playerInfo.m_strName; CharacterLogic logic = GameGOW.Get().CharacterMgr.CreateCharacter(playerInfo.m_iPlayerUID, pData); if (!m_dicTeamCount.ContainsKey(playerInfo.m_iTeam)) { m_dicTeamCount[playerInfo.m_iTeam] = 0; } BornData pBornData = pMapData.GetBornData(playerInfo.m_iTeam, m_dicTeamCount[playerInfo.m_iTeam]++); logic.Position = new UnityEngine.Vector2(pBornData.pos_x, pBornData.pos_y); logic.m_pInfo.m_iFacing = pBornData.face; logic.m_pInfo.m_iMoveEnergy = playerInfo.m_iMoveEnergy; logic.m_pInfo.m_iAddEnergy = playerInfo.m_iAddEnergy; logic.m_pInfo.m_iMaxMoveEnergy = playerInfo.m_iMoveEnergy; logic.m_pInfo.m_bIsInRound = m_iCurrentRoundPlayerIndex == i; logic.m_pInfo.m_iTeam = playerInfo.m_iTeam; logic.m_pInfo.m_iHP = playerInfo.m_iHP; logic.m_pInfo.m_iMaxHP = playerInfo.m_iHP; AddPlayerResult(playerInfo.m_iPlayerUID, playerInfo.m_iTeam); } m_iPlayerCount = m_stBattleInfo.m_listPlayers.Count; }
public void UnInitialize() { m_pInfo.UnInitialize(); m_pActionManager.Clear(); m_pBody.UnInitialize(); RemoveFromMap(); GameGOW.Get().TickerMgr.RemoveKeyTicker(this); }
public void Net_Boom(bool boom_kind) { Network.n_stShape = m_stShape; Network.n_stBorder = m_stBorder; if (GameGOW.Get().BattleMgr.m_pCurrentPlayer.ID == Network.playerid) { Network.Send_BOOM(boom_kind, _pos.x, _pos.y, this.ID); } }
public void Start() { _isLiving = true; Net_Boom_Status = 0; BombStatus = 0; Boom_Skill = SkillManager.CurrentSkillId; AddToMap(); GameGOW.Get().TickerMgr.AddKeyTicker(this); StartMoving(); }
override public void Execute() { if (Mathf.Abs(m_pTarget.y - m_pCharacter.Position.y) <= Mathf.Abs(GameGOW.Get().MapMgr.Gravity)) { ExecuteAtOnce(); } else { m_pCharacter.Position = new Vector2(m_pTarget.x, m_pCharacter.Position.y + GameGOW.Get().MapMgr.Gravity *0.5f); } }
public void Stop() { RemoveFromMap(); GameGOW.Get().TickerMgr.RemoveKeyTicker(this); GameGOW.Get().BombMgr.DeleteBomb(this.ID); _vx.Clear(); _vy.Clear(); _ef = Vector2.zero; }
public bool Initialize(object[] args) { base.Initialize(); _id = (int)args[0]; ChangeInstruction(args[1] as CharacterInstructionData); m_pBody.DoAction(CharacterStateType.IDLE); AddToMap(); GameGOW.Get().TickerMgr.AddKeyTicker(this); return(true); }
public void OnAttackForceChange() { int preSpeed = m_pInfo.m_iBombSpeed; m_pInfo.m_icanattackmax = m_pInfo.m_icanattackmin = -1f; float midforce = 100000000f; int midforcei = 0; var characterList = GameGOW.Get().CharacterMgr.GetCharacterByTeam(m_pInfo.m_iTeam, false, true); if (characterList.Count == 0) { return; } float x1 = characterList[0].Position.x; float y1 = characterList[0].Position.y; //Debug.Log("try----------" + characterList[0].Position.x); float radian = MathUtil.AngleToRadian(GetFireAngle() + CalcObjectAngle()) * m_pInfo.m_iFacing; float x0 = GetWeaponPosition().x, y0 = GetWeaponPosition().y; for (int i = 1; i <= 100; i++) { m_pInfo.m_iBombSpeed = (int)System.Math.Ceiling(1f * i / 100 * m_pInfo.m_pInstructionData.fire_range); float speedX = m_pInfo.m_iBombSpeed * Mathf.Cos(radian) * m_pInfo.m_iFacing; float speedY = m_pInfo.m_iBombSpeed * Mathf.Sin(radian); float t = (x1 - x0) / speedX / GameDefine.FRAME_TIME_INTERVAL; if (t <= 0) { continue; } if (Mathf.Abs(speedY * t + 0.5f * _gravityFactor * _map.Gravity * t * t - y1 + y0) <= midforce) { midforce = Mathf.Abs(speedY * t + 0.5f * _gravityFactor * _map.Gravity * t * t - y1 + y0); midforcei = i; } } //Debug.Log("-----------------------------"); //Debug.Log(x1); //Debug.Log(y1); //Debug.Log(radian); //Debug.Log(_gravityFactor * _map.Gravity); //Debug.Log(x0); //Debug.Log(y0); //Debug.Log(m_pInfo.m_pInstructionData.fire_range); //Debug.Log(midforcei); //Debug.Log("+++++++++++++++++++++++++++++++++++++++++++++"); m_pInfo.m_icanattackmin = 1f * midforcei / 100; m_pInfo.m_icanattackmax = 1f * midforcei / 100 + 0.1f; m_pInfo.m_iBombSpeed = preSpeed; }
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); } } }
private int _GetPlayerHp(int uid) { var stPlayer = GameGOW.Get().CharacterMgr.GetCharacterByUid(uid); if (stPlayer != null) { return(stPlayer.m_pInfo.m_iHP); } else { return(0); } }
void Awake() { m_stInst = this; GameConfig.mode = GameConfig.MODE_DEBUG; m_dicMgrs = new Dictionary <ManagerType, ManagerBase>(); ManagerBase pMgr = null; pMgr = m_pTickerMgr = new TickerManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pResourceMgr = new ResourceManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pAIMgr = new AIManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pCharacterMgr = new CharacterManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pMapMgr = new MapManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pBombMgr = new BombManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pDataMgr = new DataManager(); m_dicMgrs[pMgr.Type] = pMgr; pMgr = m_pBattleMgr = new BattleManager(); m_dicMgrs[pMgr.Type] = pMgr; int count = (int)ManagerType.MAX_MANAGER_COUNT; for (int i = 0; i < count; ++i) { ManagerType eType = (ManagerType)i; if (m_dicMgrs.ContainsKey(eType)) { m_dicMgrs[eType].Initialize(); } } m_iMapUniqueID = 0; }
public void Throw_three_Bomb(CharacterLogic A, AttackBaseData AA) { int temp = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed; GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed -= 100; GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iCurrentAngle -= 3; GameGOW.Get().BombMgr.ThrowBomb(A, AA as AttackBombData, false); GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed += 100; GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iCurrentAngle += 3; GameGOW.Get().BombMgr.ThrowBomb(A, AA as AttackBombData, true); GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed += 100; GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iCurrentAngle += 6; GameGOW.Get().BombMgr.ThrowBomb(A, AA as AttackBombData, false); }
public override void Execute() { //有剩余时间力度条才会增加减少, if (m_eAttackState == AttackState.PrepareAttack) { if (m_pCharacter.m_pInfo.m_bInBombSpeedUp && GameGOW.Get().BattleMgr.m_iCurrentRoundTime > 0) { if (m_pCharacter.m_pInfo.m_iBombSpeed < 0) { m_iSpeedFlag = -m_iSpeedFlag; m_pCharacter.m_pInfo.m_iBombSpeed = 0; } else if (m_pCharacter.m_pInfo.m_iBombSpeed > m_pCharacter.m_pInfo.m_pInstructionData.fire_range) { m_iSpeedFlag = -m_iSpeedFlag; m_pCharacter.m_pInfo.m_iBombSpeed = m_pCharacter.m_pInfo.m_pInstructionData.fire_range; } else { m_pCharacter.m_pInfo.m_iBombSpeed += m_iSpeedInterval * m_iSpeedFlag; } } else//时间到不开炮自动切换对象 { if (GameGOW.Get().BattleMgr.m_iCurrentRoundTime > 0 && m_pCharacter.IsLiving == true) // { SounderManager.Get().PlaySound(1, "sound/shooting04"); m_pCharacter.Body.DoAction(CharacterStateType.ATTACK); LOG.Log("CharacterStateType.ATTACK"); m_eAttackState = AttackState.InAttack; } else { Finish(); } } } else if (m_eAttackState == AttackState.InAttack) { if (m_pCharacter.m_pInfo.m_eCurrentStateType != CharacterStateType.ATTACK || m_pCharacter.m_pInfo.m_iCurrentFrame == m_pCharacter.m_pInfo.m_pCurrentStateData.total_frame) { Finish(); } } }
public void StartBattle(BattleInfo info, MapData pMapData) { m_iCurrentRoundPlayerIndex = 0; m_stBattleInfo = info; m_iCurrentRound = 0; m_iWaitTime = 0; InitPlayerInfo(pMapData); m_pCurrentPlayer = GameGOW.Get().CharacterMgr.GetCharacterByUid(info.m_listPlayers[m_iCurrentRoundPlayerIndex].m_iPlayerUID); m_iCurrentRoundTime = ROUND_TIME; //info.m_iRoundLimit * 60; AddEvents(); m_bIsInBattle = true; EventDispatcher.DispatchEvent("EventBattleStart", this, new ChangeControllerEvent(info.m_listPlayers[m_iCurrentRoundPlayerIndex].m_iPlayerUID)); }
private void CheckIsAttack() { if (Network.gamemode == BattleType.AI_1v1) { if (m_pInfo.m_pCurrentStateData.AttackData.ContainsKey(m_pInfo.m_iCurrentFrame)) { AttackBaseData attack = m_pInfo.m_pCurrentStateData.AttackData[m_pInfo.m_iCurrentFrame]; if (attack.Type == CharacterAttackType.BOMB && this.IsLiving == true) { AA = attack; //SkillManager.CurrentSkillId = (int)SkillManager.SkillType.Normal; //GameGOW.Get().PlaySkill(SkillManager.SkillType.Normal, this, attack) GameGOW.Get().PlaySkill((SkillManager.SkillType)SkillManager.CurrentSkillId, this, attack); // GameGOW.Get().BombMgr.ThrowBomb(this, attack as AttackBombData); } } } if (Network.NetworkMode == true) { } else { if (m_pInfo.m_pCurrentStateData.AttackData.ContainsKey(m_pInfo.m_iCurrentFrame)) { AttackBaseData attack = m_pInfo.m_pCurrentStateData.AttackData[m_pInfo.m_iCurrentFrame]; if (attack.Type == CharacterAttackType.BOMB && this.IsLiving == true) { AA = attack; //SkillManager.CurrentSkillId = (int)SkillManager.SkillType.Normal; //GameGOW.Get().PlaySkill(SkillManager.SkillType.Normal, this, attack) GameGOW.Get().PlaySkill((SkillManager.SkillType)SkillManager.CurrentSkillId, this, attack); // GameGOW.Get().BombMgr.ThrowBomb(this, attack as AttackBombData); } } } }
public void Dead() { if (Network.gamemode == BattleType.AI_1v1) { GameGOW.Get().Winner_Id = Network.playerid == this.ID ? 1 : 2; } else if (Network.NetworkMode == true) { GameGOW.Get().Winner_Id = Network.Pid_Tid[this.ID]; } else { GameGOW.Get().Winner_Id = (this.ID) == 1 ? 2 : 1; } // Debug.Log("Position +++++++++++++++++++++++"+Position.x+"-"+Position.y); _isLiving = false; //m_pInfo.m_iHP = 0; m_pBody.DoAction(CharacterStateType.DEAD); Die(); EventDispatcher.DispatchEvent("EventCharacterDead", this, new CharacterDeadEvent(this.ID)); if (Network.gamemode == BattleType.AI_1v1) { Network.Send_PVE_Over(GameGOW.Get().Winner_Id == 2); } else if (Network.NetworkMode == true) { if (Network.playerid == this.ID) { //Network.Send_Over(Network.Pid_Tid[this.ID], false); } } }
public void Act_AI_1v1() { m_bIsStart = true; ai_pre = true; time_cnt = 0; time_move = 0; time_attack = 0; ai_move = true; ai_attack = true; if (GameGOW.Get().BattleMgr.m_iCurrentRound % 2 == 1) { SkillManager.CurrentSkillId = UnityEngine.Random.Range(1, 8); if (SkillManager.CurrentSkillId == (int)SkillManager.SkillType.Robot) { SkillManager.CurrentSkillId++; } } GameGOW.Get().TickerMgr.AddKeyTicker(this); }
public static void Set_m_pCharacter(Vector2 p) { //Debug.Log("bomb vector " + p.x + "-" + p.y + " Character " + GameGOW.Get().BattleMgr.m_pCurrentPlayer.Position.x + "-" + GameGOW.Get().BattleMgr.m_pCurrentPlayer.Position.y); bool flag = false; p.x = (int)p.x; p.y = (int)p.y; if (GameGOW.Get().MapMgr.IsEmpty((int)p.x, (int)p.y) && !GameGOW.Get().MapMgr.IsOutMap(p)) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.Position = p; flag = true; } for (int i = (int)p.x - 30; i <= (int)p.x + 30; i++) { if (flag) { break; } for (int j = (int)p.y - 30; j <= (int)p.y + 30; j++) { if (flag) { break; } Vector2 temp = new Vector2(i, j); if (GameGOW.Get().MapMgr.IsOutMap(temp) == false && GameGOW.Get().MapMgr.IsEmpty(i, j)) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.Position = temp; flag = true; } } } // GameGOW.Get().BattleMgr.m_pCurrentPlayer.Position = p; GameGOW.Get().BattleMgr.m_pCurrentPlayer.Body.DoAction(CharacterStateType.IDLE1); }
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; }
// Update is called once per frame public void Tick(uint tickCount) { if (GameGOW.Get().BattleMgr.m_bIsInBattle == false) { GameGOW.Get().TickerMgr.RemoveKeyTicker(this); return; } if (false == m_bIsStart) { return; } if (ai_pre == true) { if (time_cnt <= 60) { time_cnt++; return; } else { float ai_x = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[1].m_iPlayerUID).Position.x; float en_x = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[0].m_iPlayerUID).Position.x; if (ai_x - en_x <= 1e-5) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x8); } else { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x4); } ai_pre = false; } } if (ai_move == true) { time_move++; float ai_x = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[1].m_iPlayerUID).Position.x; float en_x = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[0].m_iPlayerUID).Position.x; if (Math.Abs(ai_x - en_x) <= 200) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x0); ai_move = false; float ai_y = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[1].m_iPlayerUID).Position.y; float en_y = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[0].m_iPlayerUID).Position.y; if (Math.Abs(ai_y - en_y) >= 200) { SkillManager.CurrentSkillId = (int)SkillManager.SkillType.Rocket; } return; } if (ai_x - en_x <= 1e-5) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x8); } else { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x4); } if (time_move >= 90) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.OnDirectionKeyChanged(0x0); ai_move = false; } return; } time_attack++; if (time_attack >= 30) { var m_pCharacterLogic = GameGOW.Get().BattleMgr.m_pCurrentPlayer; m_pCharacterLogic.OnAttackForceChange(); m_pCharacterLogic.OnFunctionKeyDown(0x11); //GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed = 880; float speed = (GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_icanattackmin + GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_icanattackmax) / 2.0f; float ma = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_pInstructionData.fire_range; GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed = (int)(ma * speed); float ai_y = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[1].m_iPlayerUID).Position.y; float en_y = GameGOW.Get().CharacterMgr.GetCharacterByUid(GameGOW.Get().BattleMgr.m_stBattleInfo.m_listPlayers[0].m_iPlayerUID).Position.y; if (ai_y < en_y) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iFireAngle = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_pInstructionData.high_fire_angle; } else { GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iFireAngle = GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_pInstructionData.low_fire_angle; } if (SkillManager.CurrentSkillId == (int)SkillManager.SkillType.Cure) { GameGOW.Get().BattleMgr.m_pCurrentPlayer.m_pInfo.m_iBombSpeed = 0; } m_pCharacterLogic.OnFunctionKeyUp(0x11); m_bIsStart = false; GameGOW.Get().TickerMgr.RemoveKeyTicker(this); } }
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(); } } }
public void TestDemo(int iMapIndex) { Network.InitRound(); BattleInfo info = new BattleInfo(); info.m_iMapIndex = iMapIndex; info.m_eBattleType = BattleType.NORMAL_PVP; info.m_iRoundLimit = 10; info.m_iTimeLimit = GameDefine.INFINITE; PlayerInfo p1 = new PlayerInfo(); p1.m_iPlayerUID = 1; p1.m_iTeam = 1; p1.m_strName = "P1"; p1.m_iInstructionID = 300001; p1.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iHP; p1.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iMoveEnergy; p1.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.AI_1v1) { p1.m_strName = Network.name; p1.m_iPlayerUID = Network.playerid; p1.m_iInstructionID = Network.Player_tank * 100000 + 1; p1.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iHP; p1.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iMoveEnergy; p1.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iAddEnergy; if (Network.Player_tank == 3) { Network.default_skill = (int)SkillManager.SkillType.Rocket; } else { Network.default_skill = (int)SkillManager.SkillType.TripleBomb; } //while ((Network.skill1 = UnityEngine.Random.Range(1, 7)) == 4) ; while (true) { Network.skill1 = UnityEngine.Random.Range(1, 8); if (Network.skill1 != 4 && Network.skill1 != (int)SkillManager.SkillType.Rocket && Network.skill1 != (int)SkillManager.SkillType.TripleBomb) { break; } } } else if (Network.NetworkMode == true) { info.m_iMapIndex = Network.battleinfo.m_iMapIndex; p1.m_iPlayerUID = Network.battleinfo.m_listPlayers[0].m_iPlayerUID; p1.m_iInstructionID = Network.battleinfo.m_listPlayers[0].m_iInstructionID; p1.m_iTeam = Network.battleinfo.m_listPlayers[0].m_iTeam; p1.m_strName = Network.battleinfo.m_listPlayers[0].m_strName; } info.m_listPlayers.Add(p1); PlayerInfo p2 = new PlayerInfo(); p2.m_iPlayerUID = 2; p2.m_iTeam = 2; p2.m_strName = "P2"; p2.m_iInstructionID = 400001; p2.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iHP; p2.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iMoveEnergy; p2.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.AI_1v1) { p2.m_strName = "心是六月的情"; p2.m_iInstructionID = Network.Ai_tank * 100000 + 1; p2.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iHP; p2.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iMoveEnergy; p2.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iAddEnergy; p2.m_iPlayerUID = Network.playerid + 1; Network.playerid2 = p2.m_iPlayerUID; p2.m_iHP *= 2; p2.m_iMoveEnergy *= 10; } else if (Network.NetworkMode == true) { p2.m_iPlayerUID = Network.battleinfo.m_listPlayers[1].m_iPlayerUID; p2.m_iInstructionID = Network.battleinfo.m_listPlayers[1].m_iInstructionID; p2.m_iTeam = Network.battleinfo.m_listPlayers[1].m_iTeam; p2.m_strName = Network.battleinfo.m_listPlayers[1].m_strName; } info.m_listPlayers.Add(p2); if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { info.m_iMapIndex = 200 + info.m_iMapIndex; //info.m_iMapIndex = 201; } if (info.m_iMapIndex >= 201 || (info.m_iMapIndex > 300 && info.m_iMapIndex <= 303)) { PlayerInfo p3 = new PlayerInfo(); p3.m_iPlayerUID = 3; p3.m_iTeam = 1; p3.m_strName = "p3"; p3.m_iInstructionID = 100001; p3.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iHP; p3.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iMoveEnergy; p3.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { p3.m_iPlayerUID = Network.battleinfo.m_listPlayers[2].m_iPlayerUID; p3.m_iInstructionID = Network.battleinfo.m_listPlayers[2].m_iInstructionID; p3.m_iTeam = Network.battleinfo.m_listPlayers[2].m_iTeam; p3.m_strName = Network.battleinfo.m_listPlayers[2].m_strName; } info.m_listPlayers.Add(p3); PlayerInfo p4 = new PlayerInfo(); p4.m_iPlayerUID = 4; p4.m_iTeam = 2; p4.m_strName = "p4"; p4.m_iInstructionID = 200001; p4.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iHP; p4.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iMoveEnergy; p4.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { p4.m_iPlayerUID = Network.battleinfo.m_listPlayers[3].m_iPlayerUID; p4.m_iInstructionID = Network.battleinfo.m_listPlayers[3].m_iInstructionID; p4.m_iTeam = Network.battleinfo.m_listPlayers[3].m_iTeam; p4.m_strName = Network.battleinfo.m_listPlayers[3].m_strName; } info.m_listPlayers.Add(p4); } if (Network.gamemode == BattleType.PVP_3V3) { info.m_iMapIndex = 100 + info.m_iMapIndex; //info.m_iMapIndex = 301; } if (info.m_iMapIndex > 300 && info.m_iMapIndex <= 303) { PlayerInfo p5 = new PlayerInfo(); p5.m_iPlayerUID = 5; p5.m_iTeam = 1; p5.m_strName = "p5"; p5.m_iInstructionID = 100001; p5.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iHP; p5.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iMoveEnergy; p5.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_3V3) { p5.m_iPlayerUID = Network.battleinfo.m_listPlayers[4].m_iPlayerUID; p5.m_iInstructionID = Network.battleinfo.m_listPlayers[4].m_iInstructionID; p5.m_iTeam = Network.battleinfo.m_listPlayers[4].m_iTeam; p5.m_strName = Network.battleinfo.m_listPlayers[4].m_strName; } info.m_listPlayers.Add(p5); PlayerInfo p6 = new PlayerInfo(); p6.m_iPlayerUID = 6; p6.m_iTeam = 2; p6.m_strName = "p6"; p6.m_iInstructionID = 200001; p6.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iHP; p6.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iMoveEnergy; p6.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_3V3) { p6.m_iPlayerUID = Network.battleinfo.m_listPlayers[5].m_iPlayerUID; p6.m_iInstructionID = Network.battleinfo.m_listPlayers[5].m_iInstructionID; p6.m_iTeam = Network.battleinfo.m_listPlayers[5].m_iTeam; p6.m_strName = Network.battleinfo.m_listPlayers[5].m_strName; } info.m_listPlayers.Add(p6); } if (Network.gamemode == BattleType.AI_1v1 || Network.NetworkMode == false) { //Network.playerid = 1; Network.playerindex = 0; Network.battleinfo = info; } battleinfo = info; Network.GameLoading_Cnt = 0; Network.GameLoading = 0; for (int i = 1; i <= 10; i++) { Network.GameLoading_num[i] = 0; } if (Network.gamemode == BattleType.AI_1v1) { Network.GameLoading_num[1] = UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20); Network.GameLoading = 1; } else if (Network.NetworkMode == true) { Network.Send_GameLoading(UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20)); } else { Network.GameLoading_num[1] = UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20); Network.GameLoading = 1; } //SwitchMap(info); }