示例#1
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "Modified YT-1300 Light Freighter";

                ShipBaseArcsType = Arcs.BaseArcsType.ArcMobileDual;

                Maneuvers.Remove("1.L.T");
                Maneuvers["1.L.B"] = MovementComplexity.Normal;
                Maneuvers["1.R.B"] = MovementComplexity.Normal;
                Maneuvers.Remove("1.R.T");
                Maneuvers["2.L.B"] = MovementComplexity.Easy;
                Maneuvers["2.R.B"] = MovementComplexity.Easy;
                Maneuvers["3.L.R"] = MovementComplexity.Complex;
                Maneuvers.Add("3.L.T", MovementComplexity.Normal);
                Maneuvers.Add("3.R.T", MovementComplexity.Normal);
                Maneuvers["3.R.R"] = MovementComplexity.Complex;

                Firepower  = 3;
                MaxHull    = 8;
                MaxShields = 5;

                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Missile);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Illicit);

                ActionBar.AddPrintedAction(new RotateArcAction());
                ActionBar.AddPrintedAction(new BoostAction()
                {
                    IsRed = true
                });

                IconicPilots[Faction.Rebel] = typeof(LandoCalrissian);
            }
示例#2
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "TIE/ca Punisher";

                Maneuvers.Add("0.S.S", MovementComplexity.Complex);
                Maneuvers["2.L.T"] = MovementComplexity.Normal;
                Maneuvers["2.R.T"] = MovementComplexity.Normal;
                Maneuvers["3.L.T"] = MovementComplexity.Complex;
                Maneuvers["3.R.T"] = MovementComplexity.Complex;

                ShipBaseSize = BaseSize.Medium;

                ActionBar.AddActionLink(typeof(BoostAction), new TargetLockAction()
                {
                    IsRed = true
                });
                ActionBar.AddPrintedAction(new BarrelRollAction()
                {
                    IsRed = true
                });
                ActionBar.AddPrintedAction(new ReloadAction());

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Torpedo);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);

                IconicPilots[Faction.Imperial] = typeof(CutlassSquadronPilot);
            }
示例#3
0
 private void AssignTemporaryManeuvers()
 {
     Maneuvers.Add("1.L.T", MovementComplexity.None);
     Maneuvers.Add("1.L.B", MovementComplexity.Normal);
     Maneuvers.Add("1.F.S", MovementComplexity.Easy);
     Maneuvers.Add("1.R.B", MovementComplexity.Normal);
     Maneuvers.Add("1.R.T", MovementComplexity.None);
     Maneuvers.Add("1.F.R", MovementComplexity.None);
     Maneuvers.Add("2.L.T", MovementComplexity.Normal);
     Maneuvers.Add("2.L.B", MovementComplexity.Normal);
     Maneuvers.Add("2.F.S", MovementComplexity.Easy);
     Maneuvers.Add("2.R.B", MovementComplexity.Normal);
     Maneuvers.Add("2.R.T", MovementComplexity.Normal);
     Maneuvers.Add("2.F.R", MovementComplexity.None);
     Maneuvers.Add("3.L.T", MovementComplexity.Complex);
     Maneuvers.Add("3.L.B", MovementComplexity.Normal);
     Maneuvers.Add("3.F.S", MovementComplexity.Normal);
     Maneuvers.Add("3.R.B", MovementComplexity.Normal);
     Maneuvers.Add("3.R.T", MovementComplexity.Complex);
     Maneuvers.Add("3.F.R", MovementComplexity.None);
     Maneuvers.Add("4.F.S", MovementComplexity.Complex);
     Maneuvers.Add("4.F.R", MovementComplexity.Complex);
     Maneuvers.Add("5.F.S", MovementComplexity.None);
     Maneuvers.Add("5.F.R", MovementComplexity.None);
 }
示例#4
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers["1.L.B"] = MovementComplexity.Easy;
                Maneuvers["1.R.B"] = MovementComplexity.Easy;
                Maneuvers["2.L.B"] = MovementComplexity.Normal;
                Maneuvers["2.R.B"] = MovementComplexity.Normal;
                Maneuvers["3.F.S"] = MovementComplexity.Normal;
                Maneuvers["4.F.S"] = MovementComplexity.Complex;
                Maneuvers.Remove("5.F.S");

                factions.Remove(Faction.Rebel);

                MaxHull    = 6;
                MaxShields = 4;

                ShipBaseSize = BaseSize.Medium;

                ActionBar.RemovePrintedAction(typeof(BarrelRollAction));
                ActionBar.AddPrintedAction(new BarrelRollAction()
                {
                    IsRed = true
                });

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Torpedo);
                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Missile);
            }
示例#5
0
    void Start()
    {
        SelfDelay = Delay;
        _h        = Owner.GetComponent <HealthModule>();
        if (Owner.GetComponent <Stats>())
        {
            _st       = Owner.GetComponent <Stats>();
            _as       = Owner.GetComponent <ActiveState>();
            _man      = Owner.GetComponent <Maneuvers>();
            IsShip    = true;
            IsStation = false;
        }
        if (Owner.GetComponent <Station>())
        {
            _sb       = Owner.GetComponent <Station>();
            _sbwm     = Owner.GetComponent <WeaponModule>();
            IsShip    = false;
            IsStation = true;
        }
        moove = true;

        AllTorpedose = new GameObject[poolSize];
        for (int i = 0; i < poolSize; i++)
        {
            AllTorpedose[i] = Instantiate(Shell) as GameObject;
            AllTorpedose[i].SetActive(false);
        }
    }
示例#6
0
文件: EWing.cs 项目: marcne/FlyCasual
            public void AdaptShipToSecondEdition()
            {
                FullType = "E-wing";

                Maneuvers.Add("1.L.T", MovementComplexity.Complex);
                Maneuvers["1.L.B"] = MovementComplexity.Easy;
                Maneuvers["1.R.B"] = MovementComplexity.Easy;
                Maneuvers.Add("1.R.T", MovementComplexity.Complex);
                Maneuvers["2.L.B"] = MovementComplexity.Normal;
                Maneuvers["2.R.B"] = MovementComplexity.Normal;
                Maneuvers.Add("3.L.R", MovementComplexity.Complex);
                Maneuvers.Add("3.R.R", MovementComplexity.Complex);
                Maneuvers["4.F.S"] = MovementComplexity.Easy;

                MaxHull = 3;

                ActionBar.AddPrintedAction(new BoostAction());
                ActionBar.AddActionLink(typeof(BarrelRollAction), new TargetLockAction()
                {
                    IsRed = true
                });
                ActionBar.AddActionLink(typeof(BoostAction), new TargetLockAction()
                {
                    IsRed = true
                });

                SetTargetLockRange(2, int.MaxValue);

                IconicPilots[Faction.Rebel] = typeof(KnaveSquadronEscort);
            }
示例#7
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers["2.L.T"] = MovementComplexity.Normal;
                Maneuvers["2.R.T"] = MovementComplexity.Normal;
                Maneuvers.Add("3.F.R", MovementComplexity.Complex);

                FullType = "TIE/sa Bomber";

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Torpedo);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Bomb);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);

                ActionBar.AddActionLink(typeof(BarrelRollAction), new TargetLockAction()
                {
                    IsRed = true
                });
                ActionBar.AddPrintedAction(new ReloadAction()
                {
                    IsRed = true
                });

                IconicPilots[Faction.Imperial] = typeof(CaptainJonus);

                ShipAbilities.Add(new Abilities.SecondEdition.NimbleBomber());
            }
示例#8
0
            public void AdaptShipToSecondEdition()
            {
                ShipBaseArcsType = Arcs.BaseArcsType.ArcMobileDual;

                Maneuvers.Add("1.L.T", MovementComplexity.Complex);
                Maneuvers["1.L.B"] = MovementComplexity.Easy;
                Maneuvers["1.F.S"] = MovementComplexity.Easy;
                Maneuvers["1.R.B"] = MovementComplexity.Easy;
                Maneuvers.Add("1.R.T", MovementComplexity.Complex);
                Maneuvers["2.L.B"] = MovementComplexity.Normal;
                Maneuvers["2.R.B"] = MovementComplexity.Normal;
                Maneuvers["3.F.S"] = MovementComplexity.Normal;

                ActionBar.AddPrintedAction(new ReinforceForeAction());
                ActionBar.AddPrintedAction(new ReinforceAftAction());
                ActionBar.AddPrintedAction(new RotateArcAction());
                ActionBar.AddPrintedAction(new CoordinateAction()
                {
                    IsRed = true
                });

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Crew);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);

                IconicPilots[Faction.Imperial] = typeof(CaptainOicunn);
            }
示例#9
0
 private void AssignTemporaryManeuvers()
 {
     Maneuvers.Add("1.L.T", ManeuverColor.White);
     Maneuvers.Add("1.L.B", ManeuverColor.Green);
     Maneuvers.Add("1.F.S", ManeuverColor.Green);
     Maneuvers.Add("1.R.B", ManeuverColor.Green);
     Maneuvers.Add("1.R.T", ManeuverColor.White);
     Maneuvers.Add("1.F.R", ManeuverColor.None);
     Maneuvers.Add("2.L.T", ManeuverColor.White);
     Maneuvers.Add("2.L.B", ManeuverColor.White);
     Maneuvers.Add("2.F.S", ManeuverColor.Green);
     Maneuvers.Add("2.R.B", ManeuverColor.White);
     Maneuvers.Add("2.R.T", ManeuverColor.White);
     Maneuvers.Add("2.F.R", ManeuverColor.None);
     Maneuvers.Add("3.L.T", ManeuverColor.None);
     Maneuvers.Add("3.L.B", ManeuverColor.White);
     Maneuvers.Add("3.F.S", ManeuverColor.White);
     Maneuvers.Add("3.R.B", ManeuverColor.White);
     Maneuvers.Add("3.R.T", ManeuverColor.None);
     Maneuvers.Add("3.F.R", ManeuverColor.Red);
     Maneuvers.Add("4.F.S", ManeuverColor.White);
     Maneuvers.Add("4.F.R", ManeuverColor.Red);
     Maneuvers.Add("5.F.S", ManeuverColor.None);
     Maneuvers.Add("5.F.R", ManeuverColor.None);
 }
示例#10
0
            public void AdaptShipToSecondEdition()
            {
                //TODO: Ability

                Maneuvers.Add("1.F.V", MovementComplexity.Complex);

                ActionBar.RemovePrintedAction(typeof(TargetLockAction));
            }
 public bool HasManeuver(string maneuverString)
 {
     bool result = false;
     if (Maneuvers.ContainsKey(maneuverString))
     {
         result = (Maneuvers[maneuverString] != ManeuverColor.None);
     }
     return result;
 }
示例#12
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers.Remove("3.F.R");
                Maneuvers.Add("3.L.R", MovementComplexity.Complex);
                Maneuvers.Add("3.R.R", MovementComplexity.Complex);

                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Modification);

                ShipAbilities.Add(new Abilities.SecondEdition.AutoThrusters());
            }
示例#13
0
        public bool HasManeuver(string maneuverString)
        {
            bool result = false;

            if (Maneuvers.ContainsKey(maneuverString))
            {
                result = (Maneuvers[maneuverString] != MovementComplexity.None);
            }
            return(result);
        }
示例#14
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers.Add("0.S.S", MovementComplexity.Complex);
                Maneuvers.Remove("5.F.S");

                MaxShields = 2;

                ActionBar.AddPrintedAction(new BarrelRollAction()
                {
                    IsRed = true
                });
            }
示例#15
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers.Add("1.L.B", MovementComplexity.Normal);
                Maneuvers.Add("1.R.B", MovementComplexity.Normal);

                FullType = "TIE/ph Phantom";

                Firepower = 3;
                MaxHull   = 3;

                ShipAbilities.Add(new Abilities.SecondEdition.StygiumArray());
            }
示例#16
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers.Add("2.L.E", MovementComplexity.Complex);
                Maneuvers.Add("2.R.E", MovementComplexity.Complex);
                Maneuvers["3.F.S"] = MovementComplexity.Easy;
                Maneuvers.Remove("5.F.R");

                MaxHull = 5;

                ActionBar.AddPrintedAction(new BarrelRollAction());

                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Modification);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Modification);
            }
示例#17
0
    public void SetManeuver(Maneuvers maneuver, float direction)
    {
        if (IsManeuvering())
        {
            return;
        }

        isBoosting        = false;
        currentManeuver   = maneuver;
        maneuverDirection = Mathf.Sign(direction);
        if (OnStartManeuver != null)
        {
            OnStartManeuver();
        }
    }
示例#18
0
            public void AdaptShipToSecondEdition()
            {
                ActionBar.RemovePrintedAction(typeof(FocusAction));
                ActionBar.AddPrintedAction(new CalculateAction());

                FullType = "Aggressor Assault Fighter";

                MaxHull    = 5;
                MaxShields = 3;

                ShipBaseSize = BaseSize.Medium;

                ShipAbilities.Add(new Abilities.SecondEdition.AdvancedDroidBrain());
                Maneuvers.Add("4.F.S", MovementComplexity.Normal);
            }
示例#19
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "Z-95-AF4 Headhunter";

                Maneuvers["3.F.S"] = MovementComplexity.Easy;
                Maneuvers.Add("4.F.R", MovementComplexity.Complex);

                ActionBar.AddPrintedAction(new BarrelRollAction()
                {
                    IsRed = true
                });

                IconicPilots[Faction.Scum]  = typeof(NdruSuhlak);
                IconicPilots[Faction.Rebel] = typeof(LtBlount);
            }
示例#20
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers["2.L.B"] = MovementComplexity.Normal;
                Maneuvers["2.R.B"] = MovementComplexity.Normal;
                Maneuvers.Add("5.F.S", MovementComplexity.Normal);

                MaxHull = 3;

                AddedSlots = SlotTypes.Select(CreateSlot).ToList();
                AddedSlots.ForEach(slot => {
                    slot.GrantedBy = this;
                    UpgradeBar.AddSlot(slot);
                });

                IconicPilots[Faction.Scum] = typeof(Serissu);
            }
示例#21
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "TIE/sk Striker";

                Maneuvers.Add("1.F.R", MovementComplexity.Complex);
                Maneuvers["2.L.B"] = MovementComplexity.Easy;
                Maneuvers["2.R.B"] = MovementComplexity.Easy;
                Maneuvers.Remove("2.F.R");

                ShipAbilities.Add(new Abilities.AdaptiveAileronsAbility());

                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Bomb);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);

                IconicPilots[Faction.Imperial] = typeof(Duchess);
            }
示例#22
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "RZ-1 A-wing";

                ActionBar.AddPrintedAction(new BarrelRollAction());

                UpgradeBar.RemoveSlot(Upgrade.UpgradeType.Modification);

                Maneuvers.Add("3.L.R", MovementComplexity.Complex);
                Maneuvers.Add("3.R.R", MovementComplexity.Complex);
                Maneuvers.Remove("3.F.R");

                ShipAbilities.Add(new VectoredThrusters());

                IconicPilots[Faction.Rebel] = typeof(JakeFarrell);
            }
示例#23
0
            public void AdaptShipToSecondEdition()
            {
                //TODO: Ship ability

                FullType = "Quadrijet Transfer Spacetug";

                Maneuvers.Remove("1.F.V");
                Maneuvers.Add("2.F.V", MovementComplexity.Complex);
                Maneuvers.Add("1.L.B", MovementComplexity.Normal);
                Maneuvers.Add("1.R.B", MovementComplexity.Normal);

                ActionBar.AddPrintedAction(new EvadeAction()
                {
                    IsRed = true
                });
            }
示例#24
0
            public void AdaptShipToSecondEdition()
            {
                Maneuvers.Add("0.S.S", MovementComplexity.Complex);
                Maneuvers.Add("2.F.R", MovementComplexity.Complex);
                Maneuvers.Remove("3.F.R");
                Maneuvers["3.F.S"] = MovementComplexity.Normal;
                Maneuvers["4.F.S"] = MovementComplexity.Complex;

                MaxHull    = 5;
                MaxShields = 4;

                ShipBaseSize = BaseSize.Medium;

                ActionBar.RemovePrintedAction(typeof(EvadeAction));
                ActionBar.AddPrintedAction(new JamAction());
            }
示例#25
0
    public void Reset()
    {
        if (IsBoosting() && OnStopBoost != null)
        {
            OnStopBoost();
        }

        if (IsManeuvering() && OnStopManeuver != null)
        {
            OnStopManeuver();
        }

        boostRefillCooldownTimer = boostRefillCooldownTime;
        boostTimer = boostTime;
        isBoosting = false;
        body.Sleep();

        if (OnBoostChange != null)
        {
            OnBoostChange(boostTimer);
        }

        thrust    = 0.0f;
        pitch     = 0.0f;
        roll      = 0.0f;
        tightRoll = 0.0f;

        rotation       = transform.rotation.eulerAngles;
        targetRotation = rotation;

        speed = 0.0f;

        limitPitch    = true;
        limitRoll     = true;
        doYaw         = true;
        wrapRotation  = true;
        yawMultiplier = 1.0f;

        currentManeuver   = Maneuvers.NONE;
        maneuverDirection = 0.0f;

        oob      = false;
        apex     = false;
        righted  = false;
        finished = false;
    }
示例#26
0
文件: HWK290.cs 项目: xNyer/FlyCasual
            public void AdaptShipToSecondEdition()
            {
                FullType = "HWK-290 Light Freighter";

                Maneuvers.Add("0.S.S", MovementComplexity.Complex);
                Maneuvers.Add("3.L.T", MovementComplexity.Complex);
                Maneuvers["3.L.B"] = MovementComplexity.Normal;
                Maneuvers["3.F.S"] = MovementComplexity.Easy;
                Maneuvers["3.R.B"] = MovementComplexity.Normal;
                Maneuvers.Add("3.R.T", MovementComplexity.Complex);
                Maneuvers["4.F.S"] = MovementComplexity.Normal;

                Firepower  = 2;
                MaxHull    = 3;
                MaxShields = 2;

                ActionBar.AddActionLink(typeof(FocusAction), new RotateArcAction()
                {
                    IsRed = true
                });
                ActionBar.AddActionLink(typeof(TargetLockAction), new RotateArcAction()
                {
                    IsRed = true
                });

                ActionBar.AddPrintedAction(new BoostAction()
                {
                    IsRed = true
                });
                ActionBar.AddPrintedAction(new RotateArcAction());
                ActionBar.AddPrintedAction(new JamAction()
                {
                    IsRed = true
                });

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Turret);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Bomb);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Modification);

                ShipBaseArcsType = Arcs.BaseArcsType.ArcMobileOnly;

                IconicPilots[Faction.Scum]  = typeof(SpiceRunner);
                IconicPilots[Faction.Rebel] = typeof(KyleKatarn);
            }
示例#27
0
文件: Vcx100.cs 项目: xNyer/FlyCasual
            public void AdaptShipToSecondEdition()
            {
                //TODO: Ability

                FullType = "VCX-100 Light Freighter";

                MaxShields = 4;

                ActionBar.AddPrintedAction(new ReinforceForeAction());
                ActionBar.AddPrintedAction(new ReinforceAftAction());
                ActionBar.RemovePrintedAction(typeof(EvadeAction));

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.System);
                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Torpedo);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Gunner);

                Maneuvers.Remove("5.F.R");
                Maneuvers.Add("4.F.R", MovementComplexity.Complex);

                IconicPilots[Faction.Rebel] = typeof(HeraSyndulla);
            }
示例#28
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "A/SF-01 B-wing";

                Maneuvers["3.F.S"] = MovementComplexity.Easy;
                Maneuvers.Add("1.L.E", MovementComplexity.Complex);
                Maneuvers.Add("1.R.E", MovementComplexity.Complex);

                MaxHull    = 4;
                MaxShields = 4;

                ActionBar.AddActionLink(typeof(FocusAction), new BarrelRollAction()
                {
                    IsRed = true
                });

                PrintedUpgradeIcons.Remove(Upgrade.UpgradeType.Torpedo);
                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.Cannon);

                IconicPilots[Faction.Rebel] = typeof(BraylenStramm);
            }
示例#29
0
            public void AdaptShipToSecondEdition()
            {
                FullType = "TIE Advanced v1";

                Maneuvers.Add("2.L.E", MovementComplexity.Complex);
                Maneuvers.Add("2.R.E", MovementComplexity.Complex);
                Maneuvers["4.F.S"] = MovementComplexity.Normal;

                PrintedUpgradeIcons.Add(Upgrade.UpgradeType.System);
                UpgradeBar.RemoveSlot(Upgrade.UpgradeType.Modification);

                ActionBar.AddActionLink(typeof(BoostAction), new FocusAction()
                {
                    IsRed = true
                });
                ActionBar.AddActionLink(typeof(BarrelRollAction), new FocusAction()
                {
                    IsRed = true
                });
                ActionBar.AddPrintedAction(new EvadeAction());
            }
示例#30
0
        private void InitializeState()
        {
            State = new ShipStateInfo(this);

            State.Initiative          = PilotInfo.Initiative;
            State.PilotSkillModifiers = new List <IModifyPilotSkill>();

            State.Firepower      = ShipInfo.Firepower;
            State.Agility        = ShipInfo.Agility;
            State.HullMax        = ShipInfo.Hull;
            State.ShieldsMax     = ShipInfo.Shields;
            State.ShieldsCurrent = State.ShieldsMax;

            State.MaxForce = PilotInfo.Force;

            State.MaxCharges    = PilotInfo.Charges;
            State.RegensCharges = PilotInfo.RegensCharges;

            foreach (var maneuver in DialInfo.PrintedDial)
            {
                Maneuvers.Add(maneuver.Key.ToString(), maneuver.Value);
            }
        }
示例#31
0
    public void Reset()
    {
        if (IsBoosting() && OnStopBoost != null) {
            OnStopBoost();
        }

        if (IsManeuvering() && OnStopManeuver != null) {
            OnStopManeuver();
        }

        boostRefillCooldownTimer = boostRefillCooldownTime;
        boostTimer = boostTime;
        isBoosting = false;
        body.Sleep();

        if (OnBoostChange != null) {
            OnBoostChange(boostTimer);
        }

        thrust = 0.0f;
        pitch = 0.0f;
        roll = 0.0f;
        tightRoll = 0.0f;

        rotation = transform.rotation.eulerAngles;
        targetRotation = rotation;

        speed = 0.0f;

        limitPitch = true;
        limitRoll = true;
        doYaw = true;
        wrapRotation = true;
        yawMultiplier = 1.0f;

        currentManeuver = Maneuvers.NONE;
        maneuverDirection = 0.0f;

        oob = false;
        apex = false;
        righted = false;
        finished = false;
    }
示例#32
0
    void FixedUpdate()
    {
        if (Mathf.Abs(transform.position.x) > Constants.worldSize ||
                Mathf.Abs(transform.position.z) > Constants.worldSize) {
            oob = true;
            SetManeuver(Maneuvers.IMMELMANN, -1.0f);
        }

        if (IsManeuvering()) {
            bool done = false;
            /* Override player's flight controls with our own */
            switch (currentManeuver) {
                case Maneuvers.SOMERSAULT:
                    done = Somersault(maneuverDirection);
                    break;
                case Maneuvers.IMMELMANN:
                    done = Immelmann(maneuverDirection);
                    break;
                case Maneuvers.BARRELROLL:
                    done = BarrelRoll(maneuverDirection);
                    break;
                case Maneuvers.DODGE:
                    done = Dodge(maneuverDirection);
                    break;
            }

            if (done) {
                currentManeuver = Maneuvers.NONE;
                if (OnStopManeuver != null) {
                    OnStopManeuver();
                }
            }
        }

        if (IsBoosting()) {
            speed += boostAcceleration * Time.deltaTime;
        } else if (Mathf.Abs(thrust) > Util.Epsilon) {
            speed += acceleration * thrust * Time.deltaTime;
        }

        /* Don't allow pitching up if the player is at maximum height */
        if (!IsManeuvering() && pitch <= -Util.Epsilon &&
                transform.position.y > maxHeight) {
            pitch = 0.0f;
            Vector3 pos = transform.position;
            pos.y = maxHeight;
            transform.position = pos;
        }

        if (Mathf.Abs(pitch) > Util.Epsilon) {
            targetRotation.x = pitch * maxPitchAngle;
        } else {
            targetRotation.x = 0.0f;
        }

        /* Importantly, this is checked before tight roll */
        if (Mathf.Abs(roll) > Util.Epsilon) {
            targetRotation.z = roll * smallRollAngle;
            yawMultiplier = Mathf.Abs(roll);
        } else {
            targetRotation.z = 0.0f;
            yawMultiplier = 0.0f;
        }

        if (Mathf.Abs(tightRoll) > Util.Epsilon) {
            if (Mathf.Sign(tightRoll) != Mathf.Sign(roll)) {
                yawMultiplier = 0.0f;
            }
            targetRotation.z = tightRoll * tightRollAngle;
        }

        Vector3 vel = Vector3.zero;
        if (doYaw) {
            rotation.y -= yawMultiplier * rotation.z / 90.0f * yawSpeed * Time.deltaTime;
            yawMultiplier = 1.0f;
        } else if (oob == true) {
            rotation.y = Mathf.SmoothDamp(rotation.y, targetRotation.y, ref vel.y, pitchDampTime);
        }

        if (limitPitch) {
            rotation.x = Mathf.SmoothDamp(rotation.x, targetRotation.x, ref vel.x, pitchDampTime);
        } else {
            rotation.x += targetRotation.x / (maxPitchAngle * pitchDampTime);
        }

        if (limitRoll) {
            rotation.z = Mathf.SmoothDamp(rotation.z, targetRotation.z, ref vel.z, rollDampTime);
        } else {
            rotation.z += targetRotation.z / (smallRollAngle * rollDampTime);
        }

        if (wrapRotation) {
            rotation.x = rotation.x % 360;
            rotation.y = rotation.y % 360;
            rotation.z = rotation.z % 360;
        }

        float drag = dragCoefficient * speed * speed;
        speed -= drag * Time.deltaTime;
        /* Don't allow backing up */
        speed = Mathf.Max(0.0f, speed);

        body.velocity = transform.forward * speed;
        body.MoveRotation(Quaternion.Euler(rotation));

        if (IsBoosting()) {
            boostTimer -= Time.deltaTime;
            if (OnBoostChange != null) {
                OnBoostChange(boostTimer);
            }

            if (boostTimer <= 0.0f) {
                FinishBoost();
            }

        } else if (boostRefillCooldownTimer >= boostRefillCooldownTime && boostTimer < boostTime) {
            boostTimer = Mathf.Min(boostTimer + Time.deltaTime, boostTime);
            if (OnBoostChange != null) {
                OnBoostChange(boostTimer);
            }
        }

        if (boostRefillCooldownTimer < boostRefillCooldownTime) {
            boostRefillCooldownTimer += Time.deltaTime;
            if (OnBoostAvailable != null) {
                OnBoostAvailable();
            }
        }
    }
示例#33
0
    public void SetManeuver(Maneuvers maneuver, float direction)
    {
        if (IsManeuvering()) {
            return;
        }

        isBoosting = false;
        currentManeuver = maneuver;
        maneuverDirection = Mathf.Sign(direction);
        if (OnStartManeuver != null) {
            OnStartManeuver();
        }
    }