public override void Update(WorldScreen Game) { if (AsyncTask.IsCompleted) { Game.PushInputState(new AITurn(CurrentPlayer, AsyncTask.Result)); } }
public override void Update(WorldScreen Game) { var hoverMesh = Game.HoverNode as Gem.Render.NormalMapMeshNode; if (hoverMesh == null) return; var move = hoverMesh.Tag as Move?; if (move == null || !move.HasValue) { var coordinate = hoverMesh.Tag as Coordinate?; if (coordinate == null || !coordinate.HasValue) return; if (coordinate.Value == SelectedPiece) { hoverMesh.Hilite = true; if (Game.Main.Input.Check("CLICK")) { Cancelled = true; Game.PopInputState(); } } } else { hoverMesh.Hilite = true; if (Game.Main.Input.Check("CLICK")) { var newBoard = Coerceo.ApplyMove(Game.CurrentBoard, move.Value); Game.CurrentBoard = newBoard; Game.PopInputState(); } } }
public bool Collision(WorldScreen screen) { /* foreach(Tile t in screen.currentlay.Tiles) { if (t.type == Tile.Type.solid) { if (rec().Intersects(t.rectangle)) { alife = false; return true; } } }*/ if(rec().Intersects(screen.player.rec())) { alife = false; screen.player.health -= 1; return true; } if (!ScreenManager.Instance.cam.recCamera().Contains(new Point((int)position.X, (int)position.Y))) { alife = false; return true; } return false; }
public GameScreen(int Width, int Height) : base(Width, Height) { World = new World(); new WorldBuilder(World).Build(); World.AddEntity(new Guard(World, new XY(-2, 0))); Player = new Player(World, new XY(0, 0)); World.AddEntity(Player); World.UpdatePresent(); World.UpdateSpace(); World.brightness.Clear(); foreach (var e in World.entities.all.OfType <Light>()) { e.UpdateLight(); } WorldScreen = new WorldScreen(Width, Height - 10, World, Player); MessageScreen = new MessageScreen(Width, 10, Player) { Position = new Point(0, Height - 10) }; Children.Add(WorldScreen); Children.Add(MessageScreen); }
/// <summary> /// Constructor /// </summary> /// <param name="WS">Reference to World Screen</param> /// <param name="tileSize">Size of single tile</param> /// <param name="size">Size of map</param> public Map(WorldScreen WS, int tileSize, int size) { this.tileSize = tileSize; this.size = size; this.Entities = new List <Entity>(); PhysicalWorld = new World(new Vector2(0, 0)); Player = new Player(new Rectangle(6 * 64, 6 * 64, 64, 64), this); AddEntity(Player); chunk = new Chunk(new Rectangle(0, 0, size * tileSize, size * tileSize), this, tileSize); Parent = WS; pfinder = new PathFinderFast(GetChunk().GetCostArray()); for (int i = 0; i < 25; i++) { Rectangle r = new Rectangle((int)Helper.GetRandomTo(size * tileSize), (int)Helper.GetRandomTo(size * tileSize), 64, 64); Rectangle t = new Rectangle(r.X / tileSize, r.Y / tileSize, tileSize, tileSize); while (chunk.tiles[t.X, t.Y].isSolid) { r = new Rectangle((int)Helper.GetRandomTo(size * tileSize), (int)Helper.GetRandomTo(size * tileSize), 64, 64); t = new Rectangle(r.X / tileSize, r.Y / tileSize, tileSize, tileSize); } new ZombieBig(r, this); } new Barrel(new Rectangle(Player.Position.X + 64, Player.Position.Y + 64, 32, 32), this); new FloorFan(new Rectangle(Player.Position.X + 64, Player.Position.Y + 64, 128, 128), this); //chunk.Save("Content/Chunks/00.xml"); }
public void drawlife(SpriteBatch sprite,WorldScreen screen) { if (screen.player.health > 0) { for (int i = 0; i < screen.player.totalhealth / 2; i++) { sprite.Draw(items, new Vector2((175 + (i * 8)) * Global.zoom, 50 * Global.zoom), new Rectangle(16, 0, 7, 8), Color.White, 0f, Vector2.Zero, Global.zoom, SpriteEffects.None, 1f); } if (screen.player.health % 2 == 0) { for (int i = 0; i < screen.player.health / 2; i++) { sprite.Draw(items, new Vector2((175 + (i * 8)) * Global.zoom, 50 * Global.zoom), new Rectangle(0, 0, 7, 8), Color.White, 0f, Vector2.Zero, Global.zoom, SpriteEffects.None, 1f); } } else { int j = 0; for (int i = 0; i < (screen.player.health-1) / 2; i++) { sprite.Draw(items, new Vector2((175 + (i * 8)) * Global.zoom, 50 * Global.zoom), new Rectangle(0, 0, 7, 8), Color.White, 0f, Vector2.Zero, Global.zoom, SpriteEffects.None, 1f); j = i; } sprite.Draw(items, new Vector2((175 + ((j+1) * 8)) * Global.zoom, 50 * Global.zoom), new Rectangle(8, 0, 4, 8), Color.White, 0f, Vector2.Zero, Global.zoom, SpriteEffects.None, 1f); } } }
public override void Update(WorldScreen Game, World World) { if (BoundActor.CurrentAction is Actors.Actions.Idle) { Game.PopInputState(); } }
public void RegisterForUpdates(WorldScreen screen) { this.screensToInformOfObjectAdditions.Add(screen); foreach (GameObject o in this.objects) { screen.ShowObject(o); } }
public void draw(SpriteBatch sprite,Camera cam,WorldScreen screen) { sprite.End(); sprite.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null); sprite.Draw(texture,new Vector2(0,0),new Rectangle(0,0,texture.Width,texture.Height),Color.White,0f,Vector2.Zero,Global.zoom,SpriteEffects.None,1f); drawlife(sprite,screen); sprite.End(); sprite.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null,cam.Transform); }
public override void Exposed(WorldScreen Game) { Game.TotalMoves += 1; CurrentTurn += 1; if (CurrentTurn == 2) CurrentTurn = 0; PushTurnHandler(Game); }
public void InitalizeData() { _worldScreens = new WorldScreen[32, 32]; _worldScreenIds = new int[32, 32]; _mapIndexUsed = new bool[255]; farthestLeftTilePosition = 16; farthestRightTilePosition = 16; farthestTopTilePosition = 16; farthestBottomTilePosition = 16; }
public void attack(GameTime time , WorldScreen screen) { timera += (float)time.ElapsedGameTime.TotalMilliseconds; if(timera >175) { ball.alife = true; shoot(time, screen); timera = 0; action = Action.move; } }
public override void EnterState(WorldScreen Game) { Game.DisplayBoard(Game.CurrentBoard); var ghost = 0; foreach (var move in Coerceo.EnumerateLegalPieceMoves(SelectedPiece, Game.CurrentBoard)) { var neighbor = Coerceo.FindMoveNeighbor(SelectedPiece, move.Direction); Game.ShowGhost(ghost++, SelectedPiece.Triangle % 2, neighbor.Tile, neighbor.Triangle, move); } }
private void PushTurnHandler(WorldScreen Game) { switch (PlayerTypes[CurrentTurn]) { case PlayerType.Player: Game.PushInputState(new PlayerTurn(CurrentTurn)); break; case PlayerType.AI: Game.PushInputState(new AIThink(CurrentTurn)); break; } }
public void draw(SpriteBatch sprite,WorldScreen screen) { if(alife) { sprite.Draw(texture, position, new Rectangle(394, 228, 8, 10), Color.White); if(Global.Collisions) { sprite.Draw(screen.currentlay.collisiontex, position, new Rectangle(105, 0, 8, 10), Color.Bisque * 0.5f); } } }
public WorldScreen GetDeepCopy() { byte[] newData = new byte[Data.Length]; for (int i = 0; i < Data.Length; i++) { newData[i] = Data[i]; } WorldScreen ws = new WorldScreen(newData); return(new WorldScreen(Data)); }
public virtual void draw(SpriteBatch sprite, WorldScreen screen) { if (!death) { if (created == true) { ActualAnimation.draw(sprite, position); } else { sprite.Draw(tex, position, new Rectangle(1532, 32, 16, 16), Color.White); } } }
private void ContinueGame(GameTime gameTime) { var worldScreen = new WorldScreen(); worldScreen.LoadContent(); // update the world screen once to properly load the player entity worldScreen.Update(gameTime); var transitionScreen = new FadeTransitionScreen(this, worldScreen, 0.02f); transitionScreen.LoadContent(); GetComponent <ScreenManager>().SetScreen(transitionScreen); }
private void AdvanceTurn(WorldScreen Game) { if (Actors.Count == 0) return; if (CurrentActor == null) CurrentActor = Actors[0]; else { var cIndex = Actors.FindIndex(a => Object.ReferenceEquals(CurrentActor, a)); cIndex += 1; if (cIndex == Actors.Count) cIndex = 0; CurrentActor = Actors[cIndex]; } Game.PushInputState(new PlayerTurn(CurrentActor)); }
public override void Update(WorldScreen Game) { Timer += Game.ElapsedSeconds; foreach (var piece in Game.GhostPieceNodes) { var coordinate = piece.Tag as Coordinate?; if (coordinate == null || !coordinate.HasValue) continue; if (coordinate.Value == Coerceo.FindMoveNeighbor(ChosenMove.Coordinate, ChosenMove.Direction)) piece.Hilite = true; } if (Timer > 1) { var newBoard = Coerceo.ApplyMove(Game.CurrentBoard, ChosenMove); Game.CurrentBoard = newBoard; Game.PopInputState(); } }
/* The PokemonEngine() constructor initializes all of the important parts of the engine, including managers and screens. */ public PokemonEngine() { /* The GraphicsDeviceManager is initialized, and the PreferredBackBuffer properties are set to the constants screenWidth and screenHeight. * This means that the engine window will have these dimensions, if possible. * The ScreenRectangle is also initialized with a position of zero and the screen width and height. */ graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = screenWidth; graphics.PreferredBackBufferHeight = screenHeight; ScreenRectangle = new Rectangle(0, 0, screenWidth, screenHeight); /* The two vital components of the engine, the InputHandler and the GameStateManager, are initialized and added to the engine's master component list. * Whenever base.Update() and base.Draw() are called from this class, everything on the component list is updated and drawn. * Since these classes contain all code for handling input and for drawing the game states, everything will now be updated and drawn properly. */ Components.Add(new InputHandler(this)); stateManager = new GameStateManager(this); Components.Add(stateManager); /* Every screen is initialized. Each has a reference to the engine and the state manager passed in. */ SplashScreen = new SplashScreen(this, stateManager); StartScreen = new StartScreen(this, stateManager); WorldScreen = new WorldScreen(this, stateManager); CharacterSelectScreen = new CharacterSelectScreen(this, stateManager); LoadGameScreen = new LoadGameScreen(this, stateManager); StarterSelectScreen = new StarterSelectScreen(this, stateManager); InventoryScreen = new InventoryScreen(this, stateManager); BattleScreen = new BattleScreen(this, stateManager); SwitchScreen = new SwitchScreen(this, stateManager); /* The state stack is reset and the SplashScreen is pushed on. This means the first thing to appear when the engine is run will be the SplashScreen. */ stateManager.ChangeState(SplashScreen); /* The content root directory is set to the "/Content/" folder, meaning every filename string passed to Content.Load<T>() will start in this folder. */ Content.RootDirectory = "Content"; /* Type matchups are initialized in the PkmnUtils class, which creates the type advantage lookup table. */ PkmnUtils.InitTypeMatchups(); /* These two settings make the game run as many times per second as it can. * They could be changed later depending on how well the engine performs. */ IsFixedTimeStep = false; graphics.SynchronizeWithVerticalRetrace = false; }
public override void Update(WorldScreen Game) { Timer += Game.ElapsedSeconds; foreach (var piece in Game.PieceNodes) { var coordinate = piece.Tag as Coordinate?; if (coordinate == null || !coordinate.HasValue) continue; if (coordinate.Value == ChosenMove.Coordinate) piece.Hilite = true; } if (Timer > 1) { if (ChosenMove.Type == (byte)MoveType.MovePiece) Game.PushInputState(new AIMovePiece(ChosenMove)); else { var newBoard = Coerceo.ApplyMove(Game.CurrentBoard, ChosenMove); Game.CurrentBoard = newBoard; Game.PopInputState(); } } }
public override void Covered(WorldScreen Game) { }
public void loadContent(WorldScreen screen) { texture=screen.player.texture; }
public void RegisterForUpdates(WorldScreen screen) { this.world.RegisterForUpdates(screen); }
public Waypoint(WorldScreen screen) { this.screen = screen; Texture = TextureLoader.FromStream(File.OpenRead("Resources\\Graphics\\World\\waypoint.png")); }
public override void EnterState(WorldScreen Game, World World) { World.PrepareCombatGridForPlayerInput(); }
public override void LeaveState(WorldScreen Game) { }
public override void EnterState(WorldScreen Game) { Game.DisplayBoard(Game.CurrentBoard); AsyncTask = AIV2.PickBestMove(Game.CurrentBoard, 8); }
public override void EnterState(WorldScreen Game, World World) { //TODO: Run some kind of turn-begins rule. if (!BoundActor.Properties.TryGetPropertyAs("max-energy", out MaxEnergy)) MaxEnergy = 8; BoundActor.Properties.Upsert("turn-energy", MaxEnergy); #region Prepare GUI var guiMesh = Gem.Geo.Gen.CreatePatch( new Vector3[] { new Vector3(0,-2,4), new Vector3(6,-2,2), new Vector3(10,-2,2), new Vector3(16,-2,4), new Vector3(0,-2,2.66f), new Vector3(6,-2,1.33f), new Vector3(10,-2,1.33f), new Vector3(16,-2,2.66f), new Vector3(0,-2,1.33f), new Vector3(6,-2,0.66f), new Vector3(10,-2,0.66f), new Vector3(16,-2,1.33f), new Vector3(0,-2,0), new Vector3(6,-2,0), new Vector3(10,-2,0), new Vector3(16,-2,0) }, 8); Gui = new Gem.Gui.GuiSceneNode( guiMesh, Game.Main.GraphicsDevice, 512, 256); //Gui.LayoutScaling = new Vector2(4, 4); Gui.Orientation.Position = new Vector3(0, 2, 0); // Make this GUI 'always on top' Gui.RenderOnTop = true; Gui.DistanceBias = float.NegativeInfinity; Game.SceneGraph.Add(Gui); Gui.uiRoot.AddPropertySet(null, new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(0, 0, 1), Transparent = true }); var guardButton = new Gem.Gui.UIItem( Gem.Gui.Shape.CreateQuad(512 - 48 - 64, 128 - 32, 64, 32), new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(0.7f, 0.7f, 0.7f), ClickAction = () => Guard(), Image = Game.Main.EpisodeContent.Load<Microsoft.Xna.Framework.Graphics.Texture2D>("Content/guard"), ImageTransform = Matrix.CreateTranslation(-(512 - 48 - 64), -(128 - 32), 0) * Matrix.CreateScale(1.0f / 64, 1.0f / 32, 1.0f) }); guardButton.AddPropertySet(item => item.Hover, new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(0.9f, 0.9f, 0.9f) }); Gui.uiRoot.AddChild(guardButton); var chevronLeftEdge = 48; var chevronRightEdge = 512 - 48; var chevronRange = chevronRightEdge - chevronLeftEdge; var chevronSize = (int)Math.Round((float)chevronRange / (float)MaxEnergy); EnergyBar = new Gem.Gui.UIItem[2, MaxEnergy]; for (var chevronIndex = 0; chevronIndex < MaxEnergy; ++chevronIndex) { var topShape = MakeTopChevron( chevronLeftEdge, chevronIndex == MaxEnergy - 1 ? chevronRightEdge : chevronLeftEdge + chevronSize, 128, 128 + 64, 16, chevronIndex == 0, chevronIndex == MaxEnergy - 1); var bottomShape = MakeBottomChevron( chevronLeftEdge, chevronIndex == MaxEnergy - 1 ? chevronRightEdge : chevronLeftEdge + chevronSize, 128 + 64, 128 + 128, 16, chevronIndex == 0, chevronIndex == MaxEnergy - 1); chevronLeftEdge += chevronSize; EnergyBar[0, chevronIndex] = new Gem.Gui.UIItem(topShape, new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(0.8f, 0, 0) }); EnergyBar[1, chevronIndex] = new Gem.Gui.UIItem(bottomShape, new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(0, 0, 0.2f) }); Gui.uiRoot.AddChild(EnergyBar[0, chevronIndex]); Gui.uiRoot.AddChild(EnergyBar[1, chevronIndex]); } #endregion PrepareCombatGrid(Game, World); var hilite = Game.Main.Content.Load<Texture2D>("Content/hilite"); var footstep = Game.Main.Content.Load<Texture2D>("Content/path"); CombatGridVisual = new CombatGridVisual(World.CombatGrid); CombatGridVisual.HoverTexture = Game.Main.Content.Load<Texture2D>("Content/swirl"); CombatGridVisual.TextureTable = new Texture2D[] { hilite, footstep }; Game.SceneGraph.Add(CombatGridVisual); foreach (var actor in Game.World.Actors) { var localActor = actor; if (actor.Renderable != null) actor.Renderable.ClickAction = () => { ClearActorPopup(); CreateActorPopupGui(Game, localActor); }; } }
public override void Covered(WorldScreen Game, World World) { ClearActorPopup(); }
private void PrepareCombatGrid(WorldScreen Game, World World) { // Setup the combat grid World.PrepareCombatGridForPlayerInput(); var pathfinder = new Gem.Pathfinding<CombatCell>(c => new List<CombatCell>(c.Links.Select(l => l.Neighbor).Where(n => World.GlobalRules.ConsiderCheckRule("can-traverse", BoundActor, n) == SharpRuleEngine.CheckResult.Allow)), a => 1.0f); var path = pathfinder.Flood(World.CombatGrid.Cells[(int)BoundActor.Orientation.Position.X, (int)BoundActor.Orientation.Position.Y, (int)BoundActor.Orientation.Position.Z], c => false, c => 1.0f); var walkCommand = BoundActor.Properties.GetPropertyAsOrDefault<PlayerCommand>("walk-command"); if (walkCommand != null) { foreach (var node in path.VisitedNodes) { var commandProperties = Gem.PropertyBag.Create( "actor", BoundActor, "game", Game, "world", World, "cell", node.Key, "path", node.Value); var canWalk = walkCommand.ConsiderCheck(commandProperties); if (canWalk == SharpRuleEngine.CheckResult.Allow) { node.Key.Visible = true; node.Key.Texture = 1; node.Key.PathNode = node.Value; var localNode = node; node.Key.ClickAction = () => walkCommand.ConsiderPerform(commandProperties); node.Key.HoverAction = () => PreviewCost = (int)localNode.Value.PathCost; } } } }
private void CreateActorPopupGui(WorldScreen Game, Actor Actor) { var guiQuad = Gem.Geo.Gen.CreateQuad(); Gem.Geo.Gen.Transform(guiQuad, Matrix.CreateScale(3, 3, 1)); Gem.Geo.Gen.Transform(guiQuad, Matrix.CreateRotationX(Gem.Math.Angle.PI / 2.0f)); var gui = new Gem.Gui.GuiSceneNode(guiQuad, Game.Main.GraphicsDevice, 512, 512, Actor.Orientation); Actor.PopupGui = gui; gui.uiRoot.AddPropertySet(null, new Gem.Gui.GuiProperties { Transparent = true }); gui.uiRoot.AddChild(new Gem.Gui.UIItem( Gem.Gui.Shape.CreateWedge(new Vector2(256, 256), 1.9f, 4.1f, 128, 256, 6), new Gem.Gui.GuiProperties { BackgroundColor = new Vector3(1, 0, 0) })); UIPopupActor = Actor; }
public WorldScreenGraphic(WorldScreen worldScreen, int x, int y, int width, int height) { }
public override void Exposed(WorldScreen Game) { }
public override void Exposed(WorldScreen Game) { Game.PopInputState(); }
public World(WorldScreen screen) { this.screen = screen; }
public void update(WorldScreen screen) { if (alife) { switch (direction) { case Direction.right: if(!Collision(screen)) position.X+=speed; break; case Direction.left: if(!Collision(screen)) position.X-=speed; break; case Direction.down: if (!Collision(screen)) position.Y+=speed; break; case Direction.up: if (!Collision(screen)) position.Y-=speed; break; } } }
public override void LeaveState(WorldScreen Game, World World) { ClearActorPopup(); Game.SceneGraph.Remove(Gui); Game.SceneGraph.Remove(CombatGridVisual); }
public override void Exposed(WorldScreen Game, World World) { if (BoundActor.Properties.GetPropertyAs<int>("turn-energy", () => 0) == 0) Game.PopInputState(); else PrepareCombatGrid(Game, World); }
public void LoadWorldMap(int currentScreenIndex, int x, int y) { WorldScreen worldScreen = _worldScreenCollection.OriginalWorldScreens[currentScreenIndex]; /* if (worldScreen.IsWizardScreen()) * { * _mapIndexUsed[currentScreenIndex] = true; * WorldScreen wizardExitScreen; * if (worldScreen.ScreenIndexRight != 0xFF) * { * wizardExitScreen = _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexRight]; * LoadWorldMap(worldScreen.ScreenIndexRight, x , y); * } * else if(worldScreen.ScreenIndexLeft != 0xFF) * { * wizardExitScreen = _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexRight]; * LoadWorldMap(worldScreen.ScreenIndexLeft, x, y); * } * else if (worldScreen.ScreenIndexDown != 0xFF) * { * LoadWorldMap(worldScreen.ScreenIndexDown, x, y); * } * else if (worldScreen.ScreenIndexUp != 0xFF) * { * LoadWorldMap(worldScreen.ScreenIndexUp, x, y); * } * return; * }*/ _mapIndexUsed[currentScreenIndex] = true; _parentForm.lv_worldScreens.Items[currentScreenIndex].ForeColor = Color.Green; _worldScreens[x, y] = worldScreen; _worldScreenIds[x, y] = currentScreenIndex; if (worldScreen.ScreenIndexRight < 0xF0 && !_mapIndexUsed[worldScreen.ScreenIndexRight] && _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexRight].ParentWorld == worldScreen.ParentWorld) { int xRight = x + 1; if (farthestRightTilePosition < xRight) { farthestRightTilePosition = xRight; } LoadWorldMap(worldScreen.ScreenIndexRight, xRight, y); } if (worldScreen.ScreenIndexLeft < 0xF0 && !_mapIndexUsed[worldScreen.ScreenIndexLeft] && _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexLeft].ParentWorld == worldScreen.ParentWorld) { int xLeft = x - 1; if (farthestLeftTilePosition > xLeft) { farthestLeftTilePosition = xLeft; } LoadWorldMap(worldScreen.ScreenIndexLeft, xLeft, y); } if (worldScreen.ScreenIndexDown < 0xF0 && !_mapIndexUsed[worldScreen.ScreenIndexDown] && _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexDown].ParentWorld == worldScreen.ParentWorld) { int yDown = y - 1; if (farthestBottomTilePosition > yDown) { farthestBottomTilePosition = yDown; } LoadWorldMap(worldScreen.ScreenIndexDown, x, yDown); } if (worldScreen.ScreenIndexUp < 0xF0 && !_mapIndexUsed[worldScreen.ScreenIndexUp] && _worldScreenCollection.OriginalWorldScreens[worldScreen.ScreenIndexUp].ParentWorld == worldScreen.ParentWorld) { int yUp = y + 1; if (farthestTopTilePosition < yUp) { farthestTopTilePosition = yUp; } LoadWorldMap(worldScreen.ScreenIndexUp, x, yUp); } }
public override void Update(WorldScreen Game, World World) { if (TurnEnded) { Game.PopInputState(); return; } if (Game.HoverNode != null) { var hoverAction = Game.HoverNode.GetHoverAction(); if (hoverAction != null) hoverAction(); if (Game.Main.Input.Check("CLICK")) { var clickAction = Game.HoverNode.GetClickAction(); if (clickAction != null) clickAction(); } } int turnEnergy; if (!BoundActor.Properties.TryGetPropertyAs("turn-energy", out turnEnergy)) turnEnergy = MaxEnergy; var energySpent = MaxEnergy - turnEnergy; for (int i = 0; i < energySpent; ++i) EnergyBar[0, i].Properties[0].Values.Upsert("bg-color", new Vector3(0.2f, 0, 0)); for (int i = energySpent; i < MaxEnergy; ++i) EnergyBar[0, i].Properties[0].Values.Upsert("bg-color", new Vector3(0.7f, 0, 0)); if (energySpent + PreviewCost <= MaxEnergy) for (int i = energySpent; i < energySpent + PreviewCost; ++i) EnergyBar[0, i].Properties[0].Values.Upsert("bg-color", new Vector3(1, 0, 0)); }