Exemplo n.º 1
0
 public void FlashImage(Material img, float timeOn, float timeOff, float imgScale, int numberOfTimesToFlash, HUDAsyncController contrllr)
 {
     models [1]    = model;
     durations [0] = timeOn;
     durations [1] = timeOff;
     models [0]    = model.Clone();
     models [0].leftBackingMaterial = img;
     models [0].isLeftImageEnabled  = true;
     models [0].leftImagePosition   = new Vector3(1.98f, 0.19f, -0.39f);
     models [0].leftImageScale      = new Vector3(imgScale * 0.1280507f, 0, imgScale * 0.1280507f);
     contrllr.DoHUDUpdates(numberOfTimesToFlash, timeOn + timeOff);
 }
Exemplo n.º 2
0
		public void FlashImage(Material img, float timeOn, float timeOff, float imgScale, int numberOfTimesToFlash, HUDAsyncController contrllr)
		{
			models [1] = model;
			durations [0] = timeOn;
			durations [1] = timeOff;
			models [0] = model.Clone ();
			models [0].leftBackingMaterial = img;
			models [0].isLeftImageEnabled = true;
			models [0].leftImagePosition = new Vector3 (1.98f, 0.19f, -0.39f);
			models [0].leftImageScale = new Vector3 (imgScale * 0.1280507f, 0, imgScale * 0.1280507f);
			contrllr.DoHUDUpdates (numberOfTimesToFlash, timeOn + timeOff);
		}
Exemplo n.º 3
0
        // Extend abstract method "ChangeState(uint id)
        //
        // This is used for reacting to "OnTriggerEnter" events, called by WaypointTrigger scripts
        public override void TriggerCb(uint id)
        {
            switch (id)
            {
            case 0:      //Back to original speed
                AIVehicleCarController.MaxSpeed = 15;
                if (userMode)
                {
                    userCarController.MaxSpeed = 20;
                }
                else if (!userMode && !alreadyPassed)
                {
                    userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                }
                break;

            case 1:     //Slow Down
                AIVehicleCarController.MaxSpeed = 10;
                if (!userMode && !alreadyPassed)
                {
                    userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                }
                break;

            case 2:      //Speed Up
                AIVehicleCarController.MaxSpeed = 15;
                if (!userMode && !alreadyPassed)
                {
                    userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                }
                break;

            case 3:     //Beginning of passing track


                break;

            case 4:     //End of passing track
                //userCarController.MaxSpeed = 30;
                ChangeState(States.WaitToPass);


                break;

            case 5:     //Speed up quickly
                userCarController.FullTorqueOverAllWheels = 750;
                userCarAI.CautiousSpeedFactor             = 0.4f;
                alreadyPassed = true;
                //triggerToggle = false;
                userCarController.MaxSpeed = 20;
                break;

            case 6:                     //Speed Up North
                if (userMode)
                {
                    AIVehicleCarController.MaxSpeed = 35;
                    userCarController.MaxSpeed      = AIVehicleCarController.MaxSpeed + 0.6f;
                }
                else if (!alreadyPassed)
                {
                    AIVehicleCarController.MaxSpeed = 35;
                    userCarController.MaxSpeed      = AIVehicleCarController.MaxSpeed + 0.6f;
                }
                break;

            case 7:                     //Slow Down North
                if (userMode)
                {
                    AIVehicleCarController.MaxSpeed = 5f;
                }
                else if (!userMode && !alreadyPassed)
                {
                    //AIVehicleCarController.MaxSpeed = 10f;
                    //userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                    StartCoroutine("UserCarSlowdown");
                }
                //Turn on brake lights.
                AIVehicle.transform.GetChild(3).gameObject.SetActive(true);

                //if (userMode)
                //{

                //	AIVehicleCarController.MaxSpeed = 15f;
                //	//Turn on brake lights.
                //	AIVehicle.transform.GetChild(3).gameObject.SetActive(true);
                //}
                //else if(!alreadyPassed)
                //{
                //	AIVehicleCarController.MaxSpeed = 15f;
                //	userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                //	//Turn on brake lights.
                //	AIVehicle.transform.GetChild(3).gameObject.SetActive(true);
                //}
                break;

            case 8:
                //Turn of brakelights
                AIVehicle.transform.GetChild(3).gameObject.SetActive(false);
                break;

            case 10:
                //Can Pass
                canPass = true;
                hudController.model.bottomText = "";
                if (!alreadyPassed)
                {
                    hudController.model.bottomText = VRAVEStrings.CanPass;
                }
                break;

            case 11:
                //Cannot Pass
                canPass = false;
                hudController.model.bottomText = "";
                if (!alreadyPassed)
                {
                    hudController.model.bottomText = VRAVEStrings.CannotPass;
                }
                break;

            case 20:
                //AI Car gets to turn at 15 mph
                AIVehicleAI.ReachTargetThreshold = 2;
                break;

            case 21:
                //AI Car leaves turn from 15 mph
                AIVehicleAI.ReachTargetThreshold = 2;
                break;

            case 30:
                //User Vehicle slows down before right turn
                if (!userMode && triggerToggle && !alreadyPassed)
                {
                    StartCoroutine("SlowingAtTurn");
                    //userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed - 10.0f;
                    userCarAI.AvoidOtherCarTime     = Time.time + 3f;
                    userCarAI.AvoidOtherCarSlowdown = 0.5f;
                }
                break;

            case 31:
                //User vehicle Speeds back up
                if (!userMode && triggerToggle && !alreadyPassed)
                {
                    userCarController.MaxSpeed = AIVehicleCarController.MaxSpeed + 0.6f;
                    StartCoroutine("SpeedingAfterTurn");
                }
                break;

            case 32:
                //triggerToggle = false;
                break;

            case 33:
                //triggerToggle = true;
                break;

            case 101:
                StartCoroutine("SpeedChangesBriefing");
                break;

            case 102:
                // display right turn sign on HUD.
                //hudController.Clear();
                hudController.model.isLeftImageEnabled = false;
                hudController.models[1]    = hudController.model;
                hudController.models[0]    = hudController.model.Clone();
                hudController.durations[0] = 0.3f;
                hudController.durations[1] = 0.2f;
                hudController.models[0].leftBackingMaterial = Resources.Load(VRAVEStrings.Right_Turn, typeof(Material)) as Material;
                hudController.models[0].isLeftImageEnabled  = true;
                hudController.models[0].leftImagePosition   = new Vector3(1.98f, 0.19f, -0.39f);
                hudController.models[0].leftImageScale      = new Vector3(0.5f * 0.1280507f, 0, 0.5f * 0.1280507f);
                hudAsyncController.DoHUDUpdates(5, 0.5f);
                break;

            case 103:
                // display left turn sign on HUD.
                //hudController.Clear();
                hudController.model.isLeftImageEnabled = false;
                hudController.models[1]    = hudController.model;
                hudController.models[0]    = hudController.model.Clone();
                hudController.durations[0] = 0.3f;
                hudController.durations[1] = 0.2f;
                hudController.models[0].leftBackingMaterial = Resources.Load(VRAVEStrings.Left_Turn, typeof(Material)) as Material;
                hudController.models[0].isLeftImageEnabled  = true;
                hudController.models[0].leftImagePosition   = new Vector3(1.98f, 0.19f, -0.39f);
                hudController.models[0].leftImageScale      = new Vector3(0.5f * 0.1280507f, 0, 0.5f * 0.1280507f);
                hudAsyncController.DoHUDUpdates(5, 0.5f);
                break;

            case 104:
                //Passing Briefing
                if (userMode)
                {
                    StartCoroutine("PassingBriefing");
                }
                else
                {
                    StartCoroutine("AIPassingBriefing");
                }
                break;

            case 105:
                //UserMode end and Scenario end
                if (userMode)
                {
                    StartCoroutine("UserConclusion");
                }
                else
                {
                    StartCoroutine("ScenarioEnd");
                }
                break;

            case 106:
                //Adaptive Cruise Control
                if (!userMode)
                {
                    StartCoroutine("AdaptiveCruiseControl");
                }
                break;

            case 107:
                //AI Passing Command
                if (!userMode)
                {
                    StartCoroutine("AIPassingCommand");
                }
                break;
            }
        }