private void UpdateDecisionHasBallState() { LinkedList <DodgeBallPlayer> players = gameManager.GetPlayers(); LinkedListNode <DodgeBallPlayer> iterator = players.First; //TODO this decision making is a very first pass, //a more detailed decision making process has to be implemented //e.g. taking onto account the health of a potential target //or the level of threat that it represents DodgeBallPlayer closestPlayer = null; float minDist = float.MaxValue; for (int i = 0; i < players.Count && iterator != null; i++) { DodgeBallPlayer player = iterator.Value; iterator = iterator.Next; if (player.GetTeamId() != _dodgeBallPlayer.GetTeamId()) { float dist = Vector3.Distance(player.transform.position, this.transform.position); if (dist < minDist) { closestPlayer = player; minDist = dist; } } } if (closestPlayer != null) { } }
public void RemovePlayer(DodgeBallPlayer dodgeBallPlayer) { _players.Remove(dodgeBallPlayer); }
public void AddPlayer(DodgeBallPlayer dodgeBallPlayer) { _players.AddLast(dodgeBallPlayer); }
// Use this for initialization void Start() { _dodgeBallPlayer = GetComponent <DodgeBallPlayer>(); _aiController = GetComponent <AIController>(); }