public TileData(GameObject gameObject, BoardManager.PossibleTypes type, string tileCode, Vector2Int tilePosition) { this.gameObjectReference = gameObject; this.type = type; this.tileCode = tileCode; this.tilePosition = tilePosition; }
protected override void ExecuteLogic() { switch (currentTurnStep) { case TurnSteps.Movement: ClientPing(); if (clientController.PlayerNullableNextPosition.HasValue) { currentTurnStep = TurnSteps.PlayerWillAttack; } break; case TurnSteps.PlayerWillAttack: if (clientController.CurrentPlayerState == ClientController.PlayerState.Alien) { if (!clientController.PlayerNullableWillAttack.HasValue) { this.uiController.SetTwoButtonsVisibility(true); ClientPing(); } else { this.uiController.SetTwoButtonsVisibility(false); if (clientController.PlayerNullableWillAttack.Value) { clientController.PlayerNullableNexSound = clientController.PlayerNullableNextPosition; ActivateEffectFeedback(EffectFeedback.SectorSound); currentTurnStep = TurnSteps.SendData; } else { currentTurnStep = TurnSteps.Card; } } } else { currentTurnStep = TurnSteps.Card; } break; case TurnSteps.Card: string tileCode = BoardManager.TranslateTilePositionToCode(clientController.PlayerNullableNextPosition.Value); BoardManager.PossibleTypes tileType = clientController.GetTileType(tileCode); if (tileType == BoardManager.PossibleTypes.EventTile) { EventDeck.CardTypes cardType = clientController.Deck.DrawCard(); switch (cardType) { case EventDeck.CardTypes.AnySectorSound: TimeLogger.Log("CLIENT {0} can choose a sector to make a noise", clientController.ClientId); uiController.SetInfoText("Choose an alarm sector"); ActivateEffectFeedback(EffectFeedback.ChooseSector); clientController.GlowPossibleNoises(); currentTurnStep = TurnSteps.Noise; break; case EventDeck.CardTypes.CurrentSectorSound: TimeLogger.Log("CLIENT {0} make a noise in his sector", clientController.ClientId); ActivateEffectFeedback(EffectFeedback.SectorSound); clientController.PlayerNextSound = clientController.PlayerNextPosition; currentTurnStep = TurnSteps.Noise; break; case EventDeck.CardTypes.NoSound: TimeLogger.Log("CLIENT {0} is silent", clientController.ClientId); ActivateEffectFeedback(EffectFeedback.LuckDangerousSector); currentTurnStep = TurnSteps.SendData; break; } } else { ActivateEffectFeedback(EffectFeedback.Silent); currentTurnStep = TurnSteps.SendData; } break; case TurnSteps.Noise: ClientPing(); if (clientController.PlayerNullableNexSound.HasValue) { currentTurnStep = TurnSteps.SendData; } break; case TurnSteps.SendData: uiController.SetInfoText(); clientController.ClientCommunication.SchedulePutPlayRequest( (Vector2Int)clientController.PlayerNullableNextPosition, clientController.PlayerNullableNexSound.HasValue ? (Vector2Int)clientController.PlayerNullableNexSound : new Vector2Int(-1, -1), // TODO - check if is there better solutions than V(-1,-1) clientController.PlayerNullableWillAttack.HasValue ? (bool)clientController.PlayerNullableWillAttack : false ); StateEnd(); break; } }