Exemplo n.º 1
0
 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");
 }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 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");
 }