コード例 #1
0
ファイル: ai.cs プロジェクト: giovann997/spacewar-arena
 void Plan()
 {
     //NextTask = new FlyTo(Owner, Waypoints[NextWaypoint].AbsolutePosition);
     NextTask          = new FlySmart(Owner, Waypoints[NextWaypoint], -1);
     NextTask.NextTask = this;
     NextWaypoint      = (NextWaypoint + 1) % Waypoints.Length;
     Done = true;
     //Cheetah.Console.WriteLine("xxx");
 }
コード例 #2
0
ファイル: ai.cs プロジェクト: giovann997/spacewar-arena
        public override void Tick(float dtime)
        {
            base.Tick(dtime);

            ICollection <Actor> list = Owner.Computer.Scan();

            float     dist   = float.MaxValue;
            SpaceShip target = null;

            foreach (Actor a in list)
            {
                if (a is SpaceShip && a.Distance(Owner) < dist)
                {
                    SpaceShip s  = (SpaceShip)a;
                    Player    p1 = Owner.GetPlayer();
                    Player    p2 = s.GetPlayer();
                    if (p1 == null || p2 == null || p1.Team == -1 || p2.Team == -1 || p1.Team != p2.Team)
                    {
                        target = (SpaceShip)a;
                    }
                }
            }

            if (target != null)
            {
                Done = true;
                if (Owner.Distance(target) > 1000)
                {
                    NextTask = new FlySmart(Owner, target, 800);
                }
                else
                {
                    NextTask = new Attack(Owner, target);
                }
            }
        }
コード例 #3
0
ファイル: ai.cs プロジェクト: cody82/spacewar-arena
        public override void Tick(float dtime)
        {
            base.Tick(dtime);

            ICollection<Actor> list = Owner.Computer.Scan();

            float dist = float.MaxValue;
            SpaceShip target = null;
            foreach (Actor a in list)
            {
                if (a is SpaceShip && a.Distance(Owner) < dist)
                {
                    SpaceShip s = (SpaceShip)a;
                    Player p1 = Owner.GetPlayer();
                    Player p2 = s.GetPlayer();
                    if (p1 == null || p2 == null || p1.Team == -1 || p2.Team == -1 || p1.Team != p2.Team)
                    {
                        target = (SpaceShip)a;
                    }
                }
            }

            if (target != null)
            {
                Done = true;
                if (Owner.Distance(target) > 1000)
                    NextTask = new FlySmart(Owner, target, 800);
                else
                    NextTask = new Attack(Owner, target);
            }
        }
コード例 #4
0
ファイル: ai.cs プロジェクト: cody82/spacewar-arena
 void Plan()
 {
     //NextTask = new FlyTo(Owner, Waypoints[NextWaypoint].AbsolutePosition);
     NextTask = new FlySmart(Owner, Waypoints[NextWaypoint], -1);
     NextTask.NextTask = this;
     NextWaypoint = (NextWaypoint + 1) % Waypoints.Length;
     Done = true;
     //Cheetah.Console.WriteLine("xxx");
 }