/// <summary> /// Updates the tile state sprites, based on current game state and tile state /// </summary> private void UpdateTileStateSprite() { TileGameState tileGameState = tileData.Tile.TileGameState; switch (tileData.Tile.TileType) { case TileType.Ground: // Show ground sprite if (GameStateMachine.Instance.CurrentState is PlaceUnitsState) { if (tileGameState == TileGameState.AvailableForTakeOver || tileGameState == TileGameState.AvailableForReinforcement) { // targetColor = takeOverColor; // TODO: Create take over sprite } } if (GameStateMachine.Instance.CurrentState is AttackState) { if (tileGameState == TileGameState.AvailableAsTarget || tileGameState == TileGameState.SelectedAsTarget) { // targetColor = defenderColor; // TODO: Create defender state sprite } if (tileGameState == TileGameState.AvailableAsAttacker || tileGameState == TileGameState.SelectedAsAttacker) { // targetColor = attackerColor; // TODO: Create attackter state sprite } } if (GameStateMachine.Instance.CurrentState is InvasionState) { if (tileGameState == TileGameState.InvadingFrom) { // targetColor = invadingFromColor; // TODO: Create invading from state sprite } if (tileGameState == TileGameState.InvadingTo) { // targetColor = invadingToColor; // TODO: Create invading to state sprite } } break; case TileType.HQ: // Show hq break; } }
/// <summary> /// Constructor /// </summary> /// <param name="rend">ITileRenderer which is used for rendering and as an engine.</param> /// <param name="x">Game area X begin</param> /// <param name="y">Game area Y begin</param> /// <param name="width">Game area width</param> /// <param name="height">Game area height</param> public ITileGame(ITileRenderer rend, float x, float y, float width, float height) { m_state = TileGameState.eTILEGAMESTATE_NOTSET; m_renderer = rend; m_logoState = 0.0f; m_hudState = 0.0f; m_pengine = new ParticleEngine(rend); SetGameArea(x, y, width, height); }
/// <summary> /// Set the overall state of the game /// </summary> /// <param name="newstate">State to be set</param> public void SetGameState(TileGameState newstate) { switch (newstate) { case TileGameState.eTILEGAMESTATE_MENU: m_renderer.EffectNotify(TileGameEffect.eEFFECT_MENU, 0, 0); break; case TileGameState.eTILEGAMESTATE_GAMEOVER: m_renderer.EffectNotify(TileGameEffect.eEFFECT_GAMEOVER, 0, 0); break; } m_state = newstate; GameStateChanged(); // notify }
public void SetTileGameState(TileGameState tileGameState) { this.tileGameState = tileGameState; if (tileGameObject == null) { return; } if (tileGameState == TileGameState.NotAvailable) { tileGameObject.name = Name; } else { tileGameObject.name = Name + "-" + tileGameState.ToString(); } }