public void Update(Point mousePosition, Point mouseOffset, GameTime gameTime, MouseState mouseState) { if (mouseState.LeftButton != ButtonState.Pressed || Game1.AlreadyPressing) { return; } if (WaitingForAnimation) { (SelectedAction as Explosion).Update(gameTime); return; } LogicalPosition logicalPosition = LogicalPosition.GetLogicalPosition(mousePosition + mouseOffset); foreach (Action action in Actions) { action.Update(mousePosition, mouseOffset); if (action.Selected) { return; } } //Kolla ifall någon av actionsen utlöstes, ActionPerformed sätts till true via event-handlern HandleActionPerformed if (ActionPerformed) { ActionPerformed = false; return; } if (Grids.TryGetValue(logicalPosition, out Grid grid) && grid.Mark == null) { if (TrappedGrids.TryGetValue(logicalPosition, out Player player) && player != null && player != this) { TrappedGrids.Remove(logicalPosition); if (Waiting) { Waiting = false; } else { PlayerTurnEnd(this); } return; } grid.Mark = new Mark(logicalPosition, Mark); MarkPlaced(this, logicalPosition); //Avsluta ens tur if (Waiting) { Waiting = false; } else { PlayerTurnEnd(this); } } }
public void Place(LogicalPosition position) { if (Grids.ContainsKey(position)) { TrappedGrids.Add(position, Placer);//TODO Fixa detta ASAP } }