private void UpdateFighterCommands(GameObject _fighter) { CommandManager.Commands[] commands = _fighter.GetComponent <CommandManager>().GetCommandsForCurrentRound(); CommandManager.Commands[] validHits = new CommandManager.Commands[] { CommandManager.Commands.UpJab, CommandManager.Commands.DownJab, CommandManager.Commands.UpCross, CommandManager.Commands.DownCross, CommandManager.Commands.Uppercut, }; List <AllHits> hits = new List <AllHits>(); List <AllDefenseStances> stances = new List <AllDefenseStances>(); foreach (CommandManager.Commands command in commands) { if (Array.Exists(validHits, hit => hit == command)) { hits.Add((AllHits)command); } else { stances.Add((AllDefenseStances)command - 5); } } _fighter.GetComponent <HitsButtonsManager>().GenerateHitsButtons(hits.ToArray()); _fighter.GetComponent <DefenseButtonsManager>().GenerateDefenseButtons(stances.ToArray()); }
public static void Send(NetworkStream stream, byte[] bytes, CommandManager.Commands cmd = CommandManager.Commands.Null) { var bArray = AddByteToArray((byte)cmd, bytes); stream.Write(bArray, 0, bArray.Length); }