예제 #1
0
파일: AI.cs 프로젝트: DerNooM/HostileSpace
        public void Update(SpaceShip Player, Time Elapsed)
        {
            if (MathHelper.GetDistance(Player.Position, ship.Position) >= 1000)
            {
                return;
            }

            //ship.GetInRange(Player);

            ship.Update(Elapsed);
        }
예제 #2
0
        public void GetInRange(SpaceShip Target)
        {
            if (MathHelper.GetDistance(ship.Position, destination) > ShortRangeDistance)
            {
                velocity = (Single)Math.Min(1.0, velocity + (0.5f * Time.FromSeconds(1.0f / 60.0f).AsMilliseconds()) / mass);
            }
            else
            {
                velocity = (Single)Math.Max(0.2f, velocity - (0.5f * Time.FromSeconds(1.0f / 60.0f).AsMilliseconds()) / mass);
            }

            direction = Target.Position - ship.Position;
        }
예제 #3
0
파일: AI.cs 프로젝트: DerNooM/HostileSpace
 public AI(HostileSpace Game, SpaceShip Ship)
     : base(Game)
 {
     ship = Ship;
 }