private void TrySelectUnit() { startPos = Input.mousePosition; DoMouseHit(characterLayer); if (mouseHit.collider == null) { DoMouseHit(-1); Collider[] units = Physics.OverlapSphere(mouseHit.point, findRadius, characterLayer); if (units.Length > 0) { selected = UnityExtension.GetClosest(mouseHit.point, PController.instance.playerUnits) as CharacterManager; } else { return; } } else { selected = mouseHit.collider.GetComponent <CharacterManager>(); } if (selected == null || selected.GetTeam() != Team.Player1) { return; } mousePath.Clear(); drag = true; }
public override void StartCommand() { if (target == null) { target = UnityExtension.GetClosest(owner, PController.instance.playerUnits) as CharacterManager; } owner.Command = new FindEnemyCommand(owner); }
public override void StartCommand() { if (target == null) { target = UnityExtension.GetClosest(owner, UnitsManager.instance.localities) as Unit; } owner.Command = new FindEnemyCommand(owner); }
public void SetStartingTarget(List <Unit> units) { for (int i = 0; i < units.Count; i++) { Unit enemy = UnityExtension.GetClosest(units[i].transform, UnitsManager.instance.localities) as Unit; units[i].Command = new GuardCommand(units[i]); } }