private void RunPlay(IPlay play, Ballman player, Ballman target) { play.ShootTheJ(player, target); turnOrder.FinishTurn(); UpdateSelectedPlayer(); StartCoroutine(ResetSelector()); }
public void ShootTheJ(Ballman player, Ballman target) { player.HasBall = false; player.RunPlay(PassType); target.HasBall = true; target.RunPlay("catch_pass"); }
public void SetBallmanPosition(Ballman b, Tile newTile) { if (ballmen.ContainsKey(newTile)) { throw new Exception("COLLISION DETECTION OMG AAA GAMEDEV31337!111"); } var oldTile = ballmen.First(pair => pair.Value == b).Key; if (oldTile) { ballmen.Remove(oldTile); } ballmen.Add(newTile, b); }
private void ShowMoveButtons(Ballman bm) { court.TileSelector = null; var currentBallman = bm; var buttons = new List <Button>(); var plays = bm.GetPlays(); var position = new Vector2(Screen.width / 2f - 40, Screen.height / 2f - plays.Length * 15); foreach (var play in plays) { var newButton = Instantiate(buttonTemplate, canvas.transform); newButton.GetComponentInChildren <Text>().text = play.GetName(); newButton.gameObject.SetActive(true); newButton.onClick.AddListener(() => { buttons.ForEach((b) => Destroy(b.gameObject)); buttons.Clear(); var selector = play.GetTargetSelector(bm); court.TileSelector = selector; if (selector != null) { selector.OnSelected += (selected) => { RunPlay(play, currentBallman, court.GetBallmanAt(selected)); }; } else { RunPlay(play, currentBallman, null); } }); newButton.transform.position = position; position += new Vector2(0, 30); buttons.Add(newButton); } }
public ITileSelector GetTargetSelector(Ballman player) { return(new TeamTileSelector(player.Team)); }
public ITileSelector GetTargetSelector(Ballman player) { return(null); }
public void ShootTheJ(Ballman player, Ballman target) { }