示例#1
0
        public static bool RotarA(ThingNaveNPC nave, Vector2 destino, float fDeltaSegundos)
        {
            Vector2 diferencia = destino - nave.Centro;

            float rotacionRequerida = diferencia.Normalized().AngleInDegress - nave.RotacionEnGrados;

            return(nave.Rotar(rotacionRequerida, true, true));
        }
示例#2
0
        public static bool IrA(ThingNaveNPC nave, Vector2 destino, float fDeltaSegundos)
        {
            Vector2 diferencia = destino - nave.Centro;

            if (RotarA(nave, destino, fDeltaSegundos))
            {
                if (nave.MoverAdelante(nave.Velocidad * fDeltaSegundos, true, true))
                {
                    return(true);
                }
            }

            return(false);
        }
        public EstadoNPCRecolectar(ThingNaveNPC nave, Recurso recurso)
            : base(nave)
        {
            this.recurso = recurso;

            //Randomizo el destino para que quede dentro del radio de consumisión disponible, pero no siempre
            //en el mismo lugar
            Vector2 rand = new Vector2(0, 0);

            while (rand.X == 0 || rand.Y == 0)
            {
                rand = new Vector2(rnd.Next(-900, 900) / 1000.0f, rnd.Next(-900, 900) / 1000.0f);
            }

            this.destino = recurso.Posicion + rand * recurso.MaximaDistanciaConsumir;
        }
示例#4
0
 public EstadoNPCHuir(ThingNaveNPC nave, Thing thingAtacante)
     : base(nave)
 {
     this.thingAtacante = thingAtacante;
 }
示例#5
0
 public EstadoNPCNavegarA(ThingNaveNPC nave, Vector2 destino)
     : base(nave)
 {
     this.destino = destino;
 }
 public EstadoNPCPlanificar(ThingNaveNPC nave) : base(nave)
 {
 }
示例#7
0
 public EstadoNPC(ThingNaveNPC nave)
 {
     this.nave = nave;
 }
示例#8
0
 public EstadoNPCAtacar(ThingNaveNPC nave, ThingDaniable thingAAtacar)
     : base(nave)
 {
     this.thingAAtacar = thingAAtacar;
 }