Exemple #1
0
 // Direction coordinates must be beetween 0 and 1
 public void shoot(Vector2 direction)
 {
     displayState.Velocity = direction * _maxVelocity * 4;
     _playerWithDisk = null;
 }
Exemple #2
0
 /* -------------------------- AGENTS --------------------------- */
 public void newPlayerWithDisk(Agent player)
 {
     player.removePlayerDisk();
     _playerWithDisk = player;
 }
Exemple #3
0
 protected bool canSeePlayer(Agent agent)
 {
     Player agentPlayer = agent.getPlayer();
     List<BoundingSphere> boundingList = agentPlayer.getBoundingSpheres();
     foreach (BoundingSphere bs in boundingList) {
         if (bs.Intersects(_fov))
             return true;
     }
     return false;
 }
Exemple #4
0
 protected bool sameTeam(Agent agent)
 {
     if(agent != null)
         return agent.getTeam() == _team;
     return false;
 }
Exemple #5
0
        private bool isPlayerSameTeamNearGoal(out Agent agentPlayer)
        {
            double distance = 100000;
            agentPlayer = null;

            Vector3 pos = _player.getPositionVector();
            Vector2 thisPlayerPos = new Vector2(pos.X, pos.Z);
            Vector2 thisPlayerVector = agentBeliefs.teamGoalPosition - thisPlayerPos;
            double thisPlayerDistance = Math.Sqrt(Math.Pow(thisPlayerVector.X, 2) + Math.Pow(thisPlayerVector.Y, 2));

            foreach (KeyValuePair<Agent, Vector3> pair in agentBeliefs.sameTeamPositions) {
                Vector2 playerPos = new Vector2(pair.Value.X, pair.Value.Z);
                Vector2 playerVector = agentBeliefs.teamGoalPosition - playerPos;
                double playerDistance = Math.Sqrt(Math.Pow(playerVector.X, 2) + Math.Pow(playerVector.Y, 2));
                if (playerDistance > distance && playerDistance < thisPlayerDistance) {
                    distance = playerDistance;
                    agentPlayer = pair.Key;
                }
            }

            if (distance < thisPlayerDistance)
                return true;
            else {
                agentPlayer = null;
                return false;
            }
        }