public void RecvUpdateUnitInfo(ProtocolBase protocol) { //解析协议 int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; string protoName = proto.GetString(start, ref start); string id = proto.GetString(start, ref start); Vector3 nPos; Vector3 nRot; nPos.x = proto.GetFloat(start, ref start); nPos.y = proto.GetFloat(start, ref start); nPos.z = proto.GetFloat(start, ref start); nRot.x = proto.GetFloat(start, ref start); nRot.y = proto.GetFloat(start, ref start); nRot.z = proto.GetFloat(start, ref start); Debug.Log("RecvUpdateUnitInfo" + id); if (!list.ContainsKey(id)) { Debug.Log("RecvUpdateUnitInfo bg == null"); return; } BattleGround bg = list[id]; if (id == GameMgr.instance.username) { return; } bg.player.NetForecastInfo(nPos, nRot); }
/// <summary> /// Erstellt einen neuen GameScreen. /// </summary> public GameScreen() { this.BackgroundImage = ContentLoader.LoadImage("oldPaperTex.jpg"); cardField = new CardField(); cardField.Location = new Point(0, 650); cardField.Size = new Point(Width - 250, 800 - 650); this.AddControl(cardField); buildingsField = new BuildingsField(); buildingsField.Location = new Point(Width - 250, 0); buildingsField.Size = new Point(250, Height); this.AddControl(buildingsField); battleGround = new BattleGround(); battleGround.Location = new Point(0, 50); battleGround.Size = new Point(Width - 250, 550); this.AddControl(battleGround); ownerStatsfield = new StatsField(new Player("Spieler", 20, 5)); ownerStatsfield.Location = new Point(0, 600); ownerStatsfield.Size = new Point(Width - 250, 50); this.AddControl(ownerStatsfield); enemyStatsField = new StatsField(new Player("Gegner", 20, 10)); enemyStatsField.Location = new Point(0, 0); enemyStatsField.Size = new Point(Width - 250, 50); this.AddControl(enemyStatsField); }
public void UpdateFromBattleGround(BattleGround battleGround) { RoundNumber = battleGround.Round.RoundNumber; RoundStatus = battleGround.RoundStatus; TurnType = battleGround.Round.TurnType; TurnStatus = battleGround.TurnStatus; HeroAction = battleGround.Round.HeroAction; SelectedUnitId = battleGround.Round.SelectedUnit == null ? -1 : battleGround.Round.SelectedUnit.CombatInfo.CombatId; SelectedTargetId = battleGround.Round.SelectedTarget == null ? -1 : battleGround.Round.SelectedTarget.CombatInfo.CombatId; BattleStatus = battleGround.BattleStatus; SurpriseStatus = battleGround.SurpriseStatus; StallingRoundNumber = battleGround.StallingRoundNumber; OrderedUnitsCombatIds.Clear(); for (int i = 0; i < battleGround.Round.OrderedUnits.Count; i++) { OrderedUnitsCombatIds.Add(battleGround.Round.OrderedUnits[i].CombatInfo.CombatId); } CombatIds.Clear(); CombatIds.AddRange(battleGround.CombatIds); Companions.Clear(); for (int i = 0; i < battleGround.Companions.Count; i++) { Companions.Add(battleGround.Companions[i].GetHashCode()); } Captures.Clear(); RemovedUnits.Clear(); for (int i = 0; i < battleGround.Captures.Count; i++) { Captures.Add(battleGround.Captures[i].GetHashCode()); if (battleGround.Captures[i].RemoveFromParty) { var newRemovedUnitData = new FormationUnitSaveData(); newRemovedUnitData.UpdateFromUnit(battleGround.Captures[i].PrisonerUnit); RemovedUnits.Add(newRemovedUnitData); } } Controls.Clear(); for (int i = 0; i < battleGround.Controls.Count; i++) { Controls.Add(battleGround.Controls[i].GetHashCode()); } BattleLoot = battleGround.BattleLoot; LastDamaged = battleGround.LastDamaged; LastSkillUsed = battleGround.LastSkillUsed == null ? "" : battleGround.LastSkillUsed; MonsterFormation.UpdateFormation(battleGround.MonsterFormation); }
private void button_Click(object sender, RoutedEventArgs e) { Console.Write("Player One please select your roster;" + "\n"); Roster playerOne = buildRoster.buildRosterFromConsole(secondTest.getDataBase()); Console.Write("Player Two please selecet your roster:" + "\n"); Roster playerTwo = buildRoster.buildRosterFromConsole(secondTest.getDataBase()); BattleGround firstLoop = new BattleGround(playerOne, playerTwo, secondTest.getDataBase()); firstLoop.iterator(playerOne, playerTwo); }
/// <summary> /// 创建新的战斗 /// </summary> /// <param name="LevelID"></param> /// <param name="userRole"></param> public BattleGround Create(common.BattleType type, string mapName, int limitNumber) { BattleGround level = new BattleGround(); level.Init(type, mapName, limitNumber); level.globalID = _idcounter++; _battles.Add(_idcounter, level); return(level); }
//产生玩家 public void GeneratePlayer(string username, int team, int swopID) { //获取出生点 Transform sp = GameObject.Find("SwopPoints").transform; Transform swopTrans; if (team == 1) { Transform teamSwop = sp.GetChild(0); swopTrans = teamSwop; } else { Transform teamSwop = sp.GetChild(1); swopTrans = teamSwop; } if (swopTrans == null) { Debug.Log("出生点错误"); return; } if (playerPrefabs.Length < 2) { Debug.Log("预设玩家prefabs不足"); return; } //产生玩家 GameObject playerObj = Instantiate(playerPrefabs[team]); playerObj.name = username; playerObj.transform.position = swopTrans.position; playerObj.transform.rotation = swopTrans.rotation; //列表处理 BattleGround bg = new BattleGround(); bg.player = playerObj.GetComponent <Player>(); list.Add(username, bg); //玩家处理 if (username == GameMgr.instance.username) { bg.player.ctrlType = Player.CtrlType.player; } else { bg.player.ctrlType = Player.CtrlType.net; bg.player.InitNetCtrl(); } }
static void Main(string[] args) { var aInts = new[] { 1, 2, 3, 4, 5 }; var bInts = new[] { 6, 7, 8, 9, 10 }; var genBaseTeamA = BattleTools.GenBaseTeam(aInts, BelongTeam.A); var genBaseTeamB = BattleTools.GenBaseTeam(bInts, BelongTeam.B); var battleGround = new BattleGround(genBaseTeamA.Concat(genBaseTeamB)); var goBattle = battleGround.GoBattle(); Console.Out.WriteLine($"result::{goBattle}"); }
public State(BattleGround battleGround, StateMachine stateMachine) { _battleGround = battleGround; _stateMachine = stateMachine; }
public PauseState(BattleGround battleGround, StateMachine stateMachine) : base(battleGround, stateMachine) { }
public int NextRound(BattleGround battleground) { RoundStatus = RoundStatus.Start; OrderedUnits.Clear(); if (RoundNumber == 0 || RoundNumber == 1) { battleground.HeroFormation.UpdateBuffRule(BuffRule.FirstRound); battleground.MonsterFormation.UpdateBuffRule(BuffRule.FirstRound); } foreach (var unit in battleground.HeroParty.Units) { unit.CombatInfo.UpdateNextRound(); OrderedUnits.Add(unit); if (SceneManagerHelper.ActiveSceneName == "DungeonMultiplayer") { if (unit.Character.Class == "antiquarian") { OrderedUnits.Add(unit); } } } foreach (var unit in battleground.MonsterParty.Units) { unit.CombatInfo.UpdateNextRound(); if (unit.Character.IsMonster) { for (int i = 0; i < unit.Character.Initiative.NumberOfTurns; i++) { OrderedUnits.Add(unit); } } else { OrderedUnits.Add(unit); } if (SceneManagerHelper.ActiveSceneName == "DungeonMultiplayer") { if (unit.Character.Class == "antiquarian") { OrderedUnits.Add(unit); } } } if (RoundNumber == 0) { if (RaidSceneManager.BattleGround.SurpriseStatus == SurpriseStatus.HeroesSurprised) { OrderedUnits = new List <FormationUnit>(OrderedUnits.OrderByDescending(unit => unit.Character.IsMonster ? unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble() : unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble() - 100)); } else if (RaidSceneManager.BattleGround.SurpriseStatus == SurpriseStatus.MonstersSurprised) { OrderedUnits = new List <FormationUnit>(OrderedUnits.OrderByDescending(unit => unit.Character.IsMonster ? unit.Character.BattleModifiers != null && unit.Character.BattleModifiers.CanBeSurprised ? unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble() - 100 : unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble() : unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble())); } else { OrderedUnits = new List <FormationUnit>(OrderedUnits.OrderByDescending(unit => unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble())); } } else { OrderedUnits = new List <FormationUnit>(OrderedUnits.OrderByDescending(unit => unit.Character.Speed + RandomSolver.Next(0, 3) + RandomSolver.NextDouble())); } return(++RoundNumber); }
public void StartBattle(BattleGround battleground) { RoundNumber = 0; RoundNumber = NextRound(battleground); }
public RaidRuleInfo(string dungeon, BattleGround battleGround, TorchMeter torch) { Dungeon = dungeon; BattleGround = battleGround; TorchMeter = torch; }
public void Init(BattleGround battleGround) { _battleGround = battleGround; _moneyNode = _battleGround.GetNode <MoneyNode>("Hud/Money"); _isInit = true; }
void Awake() { BG = BattleGround.Instance; }
// public Vector3 mScreen; // public Vector2 mPoint; void Awake() { BG = BattleGround.Instance; this._Anim = GetComponent<Animator> (); }
/// <summary> /// GenerateStats battle screen and start battle. /// </summary> /// <param name="enemy"></param> private void EnterInBattle(Enemy enemy) { BattleGround.BattleResult.Clear(); BattleGround.GenerateStats(player, enemy); Visualisator.PrintBattleGround(this.dungeon, this.player, BattleGround.BattleResult); }
public PlayerAttackState(BattleGround battleGround, StateMachine stateMachine) : base(battleGround, stateMachine) { }
void Awake() { Instance = this; }