private void PlaceIndicator(OrderIndicator indicator, IIndicatableMove indicatable, GameState state) { Vector3 fromPos = GetIndicatorPositionFor(indicatable.From, state); Vector3 toPos = GetIndicatorPositionFor(indicatable.To, state); indicator.transform.position = fromPos; indicator.Target.position = toPos; }
private ReadOnlyDictionary <Faction, IEnumerable <OrderIndicator> > MakeOrderIndicators(GameObject orderIndicatorPrefab, IEnumerable <PlayerSetup> playerSetups) { Dictionary <Faction, IEnumerable <OrderIndicator> > ret = new Dictionary <Faction, IEnumerable <OrderIndicator> >(); foreach (Faction faction in playerSetups.Select(item => item.Faction)) { List <OrderIndicator> indicators = new List <OrderIndicator>(); for (int i = 0; i < FactionInteraction.MaxMoves; i++) { GameObject indicatorObject = GameObject.Instantiate(orderIndicatorPrefab); indicatorObject.name = faction.Name + " Indicator " + i; OrderIndicator indicatorScript = indicatorObject.GetComponent <OrderIndicator>(); indicators.Add(indicatorScript); } ret.Add(faction, indicators); } return(new ReadOnlyDictionary <Faction, IEnumerable <OrderIndicator> >(ret)); }
private void UpdateOrderIndicators(GameState state) { bool isSelected = _interactionManager.ActiveFaction == Faction; IIndicatableMove[] indicatables = _factionInteraction.IndicatableMoves.ToArray(); for (int i = 0; i < FactionInteraction.MaxMoves; i++) { OrderIndicator indicator = _orderIndicators[i]; bool exists = indicatables.Length > i; if (isSelected && exists) { indicator.gameObject.SetActive(true); IIndicatableMove indicatable = indicatables[i]; PlaceIndicator(indicator, indicatable, state); } else { indicator.gameObject.SetActive(false); } } }