Example #1
0
File: Disk.cs Project: Nesokas/hs
 // Direction coordinates must be beetween 0 and 1
 public void shoot(Vector2 direction)
 {
     displayState.Velocity = direction * _maxVelocity * 4;
     _playerWithDisk = null;
 }
Example #2
0
File: Disk.cs Project: Nesokas/hs
 /* -------------------------- AGENTS --------------------------- */
 public void newPlayerWithDisk(Agent player)
 {
     player.removePlayerDisk();
     _playerWithDisk = player;
 }
Example #3
0
File: Agent.cs Project: Nesokas/hs
 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;
 }
Example #4
0
File: Agent.cs Project: Nesokas/hs
 protected bool sameTeam(Agent agent)
 {
     if(agent != null)
         return agent.getTeam() == _team;
     return false;
 }
Example #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;
            }
        }