public void Read(ManeuverType maneuverType, int startTick, Euler3 direction, MovementOptions movementOptions)
 {
     base.ManeuverType = maneuverType;
     this.startTick    = new Tick(startTick);
     this.direction    = direction;
     options           = movementOptions;
 }
 public void Read(ManeuverType maneuverType, int startTick, QWEASD qweasd, MovementOptions movementOptions)
 {
     base.ManeuverType = maneuverType;
     this.startTick    = new Tick(startTick);
     this.qweasd       = qweasd;
     options           = movementOptions;
 }
Ejemplo n.º 3
0
 public void Read(ManeuverType maneuverType, int startTick, Vector3 position, Euler3 euler3)
 {
     base.ManeuverType = maneuverType;
     this.startTick    = new Tick(startTick);
     this.position     = position;
     this.euler3       = euler3;
 }
Ejemplo n.º 4
0
 public ManeuverCommandData(ManeuverCommand _command, ManeuverType _type, Vector3 _direction)
 {
     command         = _command;
     type            = _type;
     direction       = _direction;
     targetDirection = _direction;
 }
 public DirectionalWithoutRollManeuver(ManeuverType maneuverType, int startTick, Euler3 direction, MovementOptions movementOptions)
 {
     base.ManeuverType = maneuverType;
     this.startTick    = new Tick(startTick);
     this.direction    = direction;
     options           = movementOptions;
 }
Ejemplo n.º 6
0
    //Perform an update depending on the maneuver
    //and return whether or not the maneuver will continue
    public bool UpdateManeuver(ManeuverType current, Transform player)
    {
        bool continueManeuver = false;

        if (current == ManeuverType.LOOP)
            continueManeuver = UpdateLoop(player);
        else if (current == ManeuverType.U_TURN1)
            continueManeuver = UpdateUTurn1(player);
        else if (current == ManeuverType.U_TURN2)
            continueManeuver = UpdateUTurn2(player);
        else if (current == ManeuverType.L_DODGE)
            continueManeuver = UpdateLDodge(player);
        else if (current == ManeuverType.R_DODGE)
            continueManeuver = UpdateRDodge(player);

        return continueManeuver;
    }
Ejemplo n.º 7
0
 //Manually choose a maneuver
 public ManeuverType ManualManeuver(Transform player, ManeuverType maneuver)
 {
     if (maneuver == ManeuverType.L_DODGE)
     {
         //Save coordinates
         start = player;
         end = player;
         loopCount = 0;
         //Return Maneuver Type
         return ManeuverType.L_DODGE;
     }
     else if (maneuver == ManeuverType.R_DODGE)
     {
         //Save coordinates
         start = player;
         end = player;
         loopCount = 0;
         //Return Maneuver Type
         return ManeuverType.R_DODGE;
     }
     else if (maneuver == ManeuverType.U_TURN1)
     {
         //Save coordinates
         start = player;
         player.Rotate(Vector3.left * 180);
         end = player;
         player.Rotate(Vector3.left * 180);
         //Return Maneuver Type
         return ManeuverType.U_TURN1;
     }
     else if (maneuver == ManeuverType.LOOP)
     {
         //Save coordinates
         start = player;
         end = player;
         loopCount = 0;
         //Return Maneuver Type
         return ManeuverType.LOOP;
     }
     else
         return ManeuverType.NONE;
 }
Ejemplo n.º 8
0
        public void SyncMove(int index, SpaceEntityType spaceEntityType, uint objectId)
        {
            Client c = Server.GetClientByIndex(index);

            c.lastSyncSendTime = DateTime.UtcNow;

            if (!c.Character.PlayerShip.isSpawned && c.Character.PlayerShip.MovementOptions.speed > 0)
            {
                c.Character.PlayerShip.isSpawned = true;
                c.Character.PlayerShip.ManeuverController.AddManeuver(new TurnManeuver(ManeuverType.Turn, Server.GetSectorById(c.Character.PlayerShip.sectorId).Tick.Current.value, c.Character.PlayerShip.qweasd, c.Character.PlayerShip.MovementOptions)); // Avoid problems with setting speed and not moving due to being at the rest maneuver
            }

            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.SyncMove);
            buffer.Write(objectId);

            Sector s = Server.GetSectorById(c.Character.PlayerShip.sectorId);

            buffer.Write(s.Tick.Current - 1); // tick

            c.Character.PlayerShip.MovementFrame.Write(buffer);
            //c.Character.ManeuverController.GetTickFrame(s.Tick.Current - 1).Write(buffer);

            Maneuver     lastManeuverAtTick = c.Character.PlayerShip.ManeuverController.GetLastManeuverAtTick(s.Tick.Current);
            ManeuverType maneuverType       = lastManeuverAtTick.ManeuverType;

            buffer.Write((byte)maneuverType);
            buffer.Write(lastManeuverAtTick.GetStartTick());

            switch (maneuverType)
            {
            case ManeuverType.Rest:
                buffer.Write(c.Character.PlayerShip.MovementFrame.position);
                buffer.Write(c.Character.PlayerShip.MovementFrame.euler3);
                break;

            case ManeuverType.Turn:
            case ManeuverType.TurnQweasd:
                buffer.Write((byte)c.Character.PlayerShip.qweasd.Bitmask);
                break;

            case ManeuverType.Directional:
            case ManeuverType.DirectionalWithoutRoll:
                buffer.Write(c.Character.PlayerShip.direction);
                break;
            }

            ObjectStats currentShipStats = c.Character.PlayerShip.currentShipStats;

            //gear
            buffer.Write((byte)c.Character.PlayerShip.shipGear);
            //speed
            buffer.Write(c.Character.PlayerShip.shipGear == Gear.Regular ? c.Character.PlayerShip.shipSpeed : currentShipStats.BoostSpeed);
            //acceleration
            buffer.Write(currentShipStats.Acceleration);
            //inertiaCompensation
            buffer.Write(currentShipStats.InertiaCompensation);
            //pitchAcceleration
            buffer.Write(currentShipStats.PitchAcceleration);
            //pitchMaxSpeed
            buffer.Write(currentShipStats.PitchMaxSpeed);
            //yawAcceleration
            buffer.Write(currentShipStats.YawAcceleration);
            //yawMaxSpeed
            buffer.Write(currentShipStats.YawMaxSpeed);
            //rollAcceleration
            buffer.Write(currentShipStats.RollAcceleration);
            //rollMaxSpeed
            buffer.Write(currentShipStats.RollMaxSpeed);
            //strafeAcceleration
            buffer.Write(currentShipStats.StrafeAcceleration);
            //strafeMaxSpeed
            buffer.Write(currentShipStats.StrafeMaxSpeed);

            SendMessageToSector(index, buffer);
        }