Beispiel #1
0
        public override SpaceShipControlInput GetConstrols()
        {
            SpaceShipControlInput input = new SpaceShipControlInput();

            input.LookAt = Target;

            Vector3 dir  = Target - Owner.AbsolutePosition;
            float   dist = dir.Length;

            if (dist > lastdist)
            {
                stop     = true;
                lastdist = float.PositiveInfinity;
            }

            if (Owner.Speed.Length < 1)
            {
                stop = false;
            }

            input.Strafe = stop?0:Math.Sign(Owner.GetCosDirection(Target));

            input.Thrust = stop?0:Math.Min((dist * dist) / (500.0f * 500.0f), 1.0f);

            if (dist < 200)
            {
                Done = true;
            }

            return(input);
        }
Beispiel #2
0
        public override SpaceShipControlInput GetConstrols()
        {
            SpaceShipControlInput input = new SpaceShipControlInput();


            return(input);
        }
Beispiel #3
0
        public override SpaceShipControlInput GetConstrols()
        {
            SpaceShipControlInput input = new SpaceShipControlInput();

            input.LookAt = 2 * Owner.AbsolutePosition - Target.AbsolutePosition;
            input.Thrust = 1;

            return(input);
        }
Beispiel #4
0
        public override SpaceShipControlInput GetConstrols()
        {
            SpaceShipControlInput i = base.GetConstrols();

            if (Done)
            {
                Done = false;
                currentnode++;
                if (currentnode >= astar.Solution.Count)
                {
                    currentnode--;
                    Done = true;
                }
            }
            return(i);
        }
Beispiel #5
0
        public override SpaceShipControlInput GetConstrols()
        {
            SpaceShipControlInput input = new SpaceShipControlInput();

            input.LookAt = Target.AbsolutePosition;
            input.Thrust = 1;

            float dist = Owner.Distance(Target);

            Vector3 dir = Target.AbsolutePosition - Owner.AbsolutePosition;

            if (dir.LengthSquared > 0)
            {
                dir.Normalize();
                if ((float)Math.Acos(Vector3.Dot(dir, Owner.Direction)) < (float)Math.PI / 18 && dist < 2000)
                {
                    input.Fire1 = true;
                }
            }

            if (dist < 1000)
            {
                input.Strafe = 1;
                strafetime  += Root.Instance.TickDelta;
                if (strafetime > 10)
                {
                    Done     = true;
                    NextTask = new Retreat(Owner, Target);
                }
            }
            else
            {
                strafetime = 0;
            }

            if (dist < Owner.Radius * 3)
            {
                Done     = true;
                NextTask = new Retreat(Owner, Target);
            }
            return(input);
        }