public void StartGame() { while (!IsEndOfTheGame()) { InitializeTurn(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("--------------------------------------------------------------------------------------------"); Console.ResetColor(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Tura { CurrentTurn++ }:"); int playedCardPower = 0; while (playedCardPower != -1) { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(ActualPlayer.ToString()); Console.Write($"Wybór karty nr: "); string wybor = ActualPlayer.GetChoice(); if (string.IsNullOrWhiteSpace(wybor)) { break; } playedCardPower = ActualPlayer.PlayCard(int.Parse(wybor)); if (playedCardPower > 0) { GetOpponent().GetHit(playedCardPower); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{ GetOpponent().Name } dostał obrażenia równe { playedCardPower }"); Console.ResetColor(); Console.WriteLine(); } if (ActualPlayer.PlayerStatistics.ActualMana <= 0 || playedCardPower == -1 || playedCardPower == -2) { playedCardPower = -1; } if (GetWinner() != null) { break; } } Console.ResetColor(); SwapPlayer(); } Console.WriteLine(); Console.WriteLine($"Koniec gry, zwyciężył gracz { GetWinner().Name }"); }
void Start() { m_cameraMovement = Camera.main.GetComponent <CameraMovement>(); m_input = Game.Instance.Input; m_actualPlayer1 = new ActualPlayer() { id = 0, original_startposition = Vector3.left * 2.5f + Vector3.up * 1f }; m_actualPlayer2 = new ActualPlayer() { id = 1, original_startposition = Vector3.right * 3f + Vector3.up * 1f }; SpawnPlayer(m_actualPlayer1, Vector3.zero); SpawnPlayer(m_actualPlayer2, Vector3.zero); // Debug.Log(m_input.GetController(0).GetJoystick(0).x); }
private void Start() { _scenePrefab = Resources.Load("Multiplayer/MultiplayerScene") as GameObject; var sceneObject = Instantiate(_scenePrefab, transform) as GameObject; _multiplayerScene = sceneObject.GetComponent <MultiplayerScene>(); _playerPrefab = Resources.Load("Multiplayer/ActualPlayer") as GameObject; var playerObject = Instantiate(_playerPrefab, transform) as GameObject; _actualPlayer = playerObject.GetComponent <ActualPlayer>(); _playerModels = new Dictionary <int, PlayerModel>(); EventManager.Singleton.Subscribe(GameEventType.SendMultiplayerMessage, OnSendMultiplayerMessage); EventManager.Singleton.Subscribe(GameEventType.ReceiveNetworkMessage, OnReceiveNetworkMessage); EventManager.Singleton.Subscribe(GameEventType.HostStarted, OnHostStarted); EventManager.Singleton.Subscribe(GameEventType.HostStartedInFallback, OnHostStarted); EventManager.Singleton.Subscribe(GameEventType.ClientStarted, OnClientStarted); EventManager.Singleton.Subscribe(GameEventType.StartGame, OnStartGame); EventManager.Singleton.Subscribe(GameEventType.PublishPlayersList, OnPublishPlayers); }
void SpawnPlayer(ActualPlayer actualPlayer, Vector3 startposition_offset) { actualPlayer.m_player = (Player)Instantiate(m_playerPrefab, actualPlayer.original_startposition + startposition_offset, Quaternion.identity); actualPlayer.m_player.Init(m_input.GetController(actualPlayer.id)); m_cameraMovement.AddTarget(actualPlayer.m_player.gameObject); }
public void InitializeTurn() { ActualPlayer.DrawCardFromDeck(); ActualPlayer.InitializeStatistics(); }