int GetIntFromEnum(CurrentGear currGear_)
    {
        if (currGear_ == CurrentGear.Zero)  return 1;
        if (currGear_ == CurrentGear.One)   return 2;
        if (currGear_ == CurrentGear.Two)   return 3;
        if (currGear_ == CurrentGear.Three) return 4;
        if (currGear_ == CurrentGear.Four)  return 5;

        return 1;
    }
Example #2
0
        private void StartKickdown()
        {
            switch (_kickdownCharacteristics.GetActionFor(ResponsivenessMode, LastGasPressure, CurrentRpm))
            {
            case SuggestedKickdownAction.Singular:
                _gearshiftService.TargetGear(CurrentGear.DownshiftedBy(new Gear(1)));
                break;

            case SuggestedKickdownAction.Double:
                _gearshiftService.TargetGear(CurrentGear.DownshiftedBy(new Gear(2)));
                break;
            }

            IsKickdownStarted = true;
        }
Example #3
0
        public bool Equals(Vehicle other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Matrix.Equals(other.Matrix) &&
                   EntityType.Equals(other.EntityType) &&
                   EntityStatus.Equals(other.EntityStatus) &&
                   EntityFlags.Equals(other.EntityFlags) &&
                   AutoPilot.Equals(other.AutoPilot) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   AlarmState.Equals(other.AlarmState) &&
                   MaxNumPassengers.Equals(other.MaxNumPassengers) &&
                   Field1D0h.Equals(other.Field1D0h) &&
                   Field1D4h.Equals(other.Field1D4h) &&
                   Field1D8h.Equals(other.Field1D8h) &&
                   Field1DCh.Equals(other.Field1DCh) &&
                   SteerAngle.Equals(other.SteerAngle) &&
                   GasPedal.Equals(other.GasPedal) &&
                   BrakePedal.Equals(other.BrakePedal) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   IsLawEnforcer.Equals(other.IsLawEnforcer) &&
                   IsLockedByScript.Equals(other.IsLockedByScript) &&
                   IsEngineOn.Equals(other.IsEngineOn) &&
                   IsHandbrakeOn.Equals(other.IsHandbrakeOn) &&
                   LightsOn.Equals(other.LightsOn) &&
                   HasFreebies.Equals(other.HasFreebies) &&
                   Health.Equals(other.Health) &&
                   CurrentGear.Equals(other.CurrentGear) &&
                   ChangeGearTime.Equals(other.ChangeGearTime) &&
                   TimeOfDeath.Equals(other.TimeOfDeath) &&
                   BombTimer.Equals(other.BombTimer) &&
                   DoorLock.Equals(other.DoorLock));
        }
    // Update is called once per frame
    void Update()
    {
        if(GameObject.Find("LightWall_Player(Clone)"))
        {
            GameObject.Destroy(GameObject.Find("LightWall_Player(Clone)"));
        }

        if(!b_IsTutorial)
        {
        #region Not Tutorial

            if (f_BeginningTimer > -0.1) f_BeginningTimer -= Time.deltaTime;

            if (f_BeginningTimer <= 0.0f)
            {
                Text_Timer.GetComponent<Text>().enabled = false;
            }

            if (b_Beginning)
            {
                Text_Timer.GetComponent<Text>().text = string.Format("{0:0}", f_BeginningTimer - 1);
                GameObject.Find("PlayerScore").GetComponent<Text>().text = "Score:\n";
                GameObject.Find("LevelInfo").GetComponent<Text>().text = "Level:\n";

                if (f_BeginningTimer <= 1.5f)
                {
                    audioSource.Play();
                    Text_Timer.GetComponent<Text>().text = "Go!";

                    enum_CurrGear = CurrentGear.Zero;
                    SetGearMinMax(0);
                    ToggleDriveMode();

                    f_CurrSpeed = f_MaxSpeed_GearZero;
                    b_Beginning = false;

                    GameObject.Find("LevelManager").GetComponent<Cs_LevelManager>().StartGame();

                }
            }

            if (!b_IsGameOver)
            {
                prevState = state;
                state = GamePad.GetState(playerIndex);

                if (state.Buttons.RightShoulder == ButtonState.Pressed && prevState.Buttons.RightShoulder == ButtonState.Released)
                {
                    GameObject.Find("LevelManager").GetComponent<Cs_LevelManager>().PlayerScoredPrimary();
                    gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * 0;

                    /*
                    b_IsGameOver = true;

                    gameObject.GetComponent<Renderer>().enabled = false;
                    gameObject.GetComponent<BoxCollider>().enabled = false;

                    Text_YouLose.GetComponent<Text>().text = "Cheater!";
                    Text_YouLose.SetActive(true);
                    */
                }

                if (enum_CurrGear != CurrentGear.Off)
                {
                    Update_Speed();
                    TurnCycle();
                }

                /*
                if (state.Buttons.A == ButtonState.Pressed && prevState.Buttons.A == ButtonState.Released && enum_CurrGear == CurrentGear.Off)
                {
                    enum_CurrGear = CurrentGear.Zero;
                    SetGearMinMax(0);
                    ToggleDriveMode();

                    f_CurrSpeed = f_MaxSpeed_GearZero;
                }
                */

                if (!b_DriveMode)
                {
                    PlaceWall();
                }
            }
            else
            {
                f_EndGameTimer += Time.deltaTime;

                if (f_EndGameTimer >= 5.0f)
                {
                    SceneManager.LoadScene(0);
                }
            }

        #endregion
        }
        else
        {
        #region Tutorial

        #endregion
        }
    }
    // Use this for initialization
    void Start()
    {
        #if !UNITY_EDITOR
        UnityEngine.Cursor.visible = false;
        #endif

        b_IsTutorial = true;

        f_CurrSpeed = 0f;

        enum_CurrGear = CurrentGear.Off;

        // Pre-load the light wall
        oldWallRef = new GameObject();
        oldWallRef.transform.position = lastWallReference.transform.position;
        oldWallRef.name = NameLightWall();

        newWallRef = new GameObject();
        newWallRef.transform.position = lastWallReference.transform.position;
        newWallRef.name = NameLightWall();

        playerLightWall = Instantiate(GO_LightWall, oldWallRef.transform.position, newWallRef.transform.rotation) as GameObject;
        lastWallMade = playerLightWall.name;

        Text_YouLose.SetActive(false);
        Text_Timer.SetActive(true);
    }