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)); }
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; }
public EstadoNPCHuir(ThingNaveNPC nave, Thing thingAtacante) : base(nave) { this.thingAtacante = thingAtacante; }
public EstadoNPCNavegarA(ThingNaveNPC nave, Vector2 destino) : base(nave) { this.destino = destino; }
public EstadoNPCPlanificar(ThingNaveNPC nave) : base(nave) { }
public EstadoNPC(ThingNaveNPC nave) { this.nave = nave; }
public EstadoNPCAtacar(ThingNaveNPC nave, ThingDaniable thingAAtacar) : base(nave) { this.thingAAtacar = thingAAtacar; }