Exemple #1
0
    void HandleNextStep()
    {   //what happen after current gameobject instruction
        UpdateNextStepIndex++;
        Debug.Log("update nextstep index: " + UpdateNextStepIndex);

        if (sfx != null)
        {
            sfx.StopSound("wrong_s");
            sfx.PlaySound("correct_s");
        }

        ActivateMe(FeedbackCorrect);

        DeactivateMe(FeedbackIncorrect);

        switch (UpdateNextStepIndex)
        {
        case 0:         //cupEnabling

            //remove bob
            DeactivateMe(ObjectsInGame[CurrentGameObjectIndex]);

            //WeightCalculator.WeightCalIns.SetExitCallTrueAfterObjDisappearFromMe(ObjectsInGame[CurrentGameObjectIndex]);

            DestroyGameObject(CurrentGameObjectIndex);

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            //cup
            insCont.IncInsIndex();

            break;

        case 1:         //cup for water pouring enaling

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //cup left side
            insCont.IncInsIndex();

            break;

        case 2:         //water cylinder enable

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            // pour water
            insCont.IncInsIndex();

            break;

        case 3:     //after collided with water cylinder under tap enabling    //guidance collision call me

            //insCont.IncInsIndex();

            ObjectsInGame[CurrentGameObjectIndex].GetComponent <Rigidbody>().useGravity  = false;
            ObjectsInGame[CurrentGameObjectIndex].GetComponent <Rigidbody>().isKinematic = true;
            ObjectsInGame[CurrentGameObjectIndex].layer = 2;

            TapWaterBtn.GetComponent <Button>().interactable = true;
            //TapController.TapControllerInstance.ActivateTapPointer();
            //pouring water enabling -> tap button enabling

            break;

        case 4:         //after water in cylinder , tap controller call me

            //enable raycast on cylinder
            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<Rigidbody>().useGravity = true;
            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<Rigidbody>().isKinematic = false;
            ObjectsInGame[CurrentGameObjectIndex].layer = 0;

            //increment next shadow     // for tilt beaker
            sHand.UpdateGuidanceObject();

            break;

        case 5:     //collide with tilt cylinder, guidance collider call me

            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<SmoothRotationController>().StartRotation();

            break;

        case 6:     //smooth rotation call me, to pour water;

            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<WaterPouring>().ActivateWaterFlow();

            //ObjectsInGame[CurrentGameObjectIndex].layer = 2;    //cylinder

            //ObjectsInGame[CurrentGameObjectIndex-1].layer = 0;


            //fill cup with water
            //ObjectsInGame[CurrentGameObjectIndex - 1].GetComponent<LiquidContainer>().FillAmountPercent = GetCylinderWaterLevel();

            //ObjectsInGame[CurrentGameObjectIndex - 1].GetComponent<CupMassHandler>().AddWaterMassInMe();

            //update water mass         //after update case 7 call
            UpdateScene();

            break;

        case 7:     //water pouring call me - after water added - cylinder to cup

            //cup layer changed to move
            ObjectsInGame[CurrentGameObjectIndex - 1].layer = 0;

            DestroyMe(ObjectsInGame[CurrentGameObjectIndex]);

            //if (MassesSubmissionHandler.MassesSubmissionHandlerInstance != null)
            //    MassesSubmissionHandler.MassesSubmissionHandlerInstance.ActivateNextButton();

            //increment next shadow     // for tilt beaker
            sHand.UpdateGuidanceObject();

            //weigh cup second time
            insCont.IncInsIndex();

            break;

        case 8:     //water filled cup mass submission button called me

            //Debug.Log("me case 8 hoo: ");
            //cup remove
            DestroyMe(ObjectsInGame[CurrentGameObjectIndex - 1]);

            //balance machine remove
            DestroyMe(GameObject.Find("BalanceMachine"));

            //remove inventory
            uiHand.DeActivateMassCalSceneInventory();         //bob,cup,water_cylinder

            //update next scene
            StartCoroutine(UpdateHeatSetupScene(1f));

            break;

        case 9:             //wooden, tri,
        case 10:

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            break;

        case 11:        //bunsen

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            //Take a beaker and add water
            insCont.IncInsIndex();

            break;

        case 12:       // frst beaker place

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            TapWaterBtn.GetComponent <Button>().interactable = true;
            //TapController.TapControllerInstance.ActivateTapPointer();

            break;

        case 13:                                             //tap controller call me

            ObjectsInGame[CurrentGameObjectIndex].layer = 0; // frst beaker place can move

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //Place the beaker on tripod stand
            insCont.IncInsIndex();

            break;

        case 14:                                                                                                          //for frst thermometer update, guidance call me

            ObjectsInGame[CurrentGameObjectIndex].transform.localRotation = Quaternion.Euler(new Vector3(0f, -180f, 0f)); //rotate beaker, its labels to backward
            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            //suspend thermometer
            insCont.IncInsIndex();

            break;

        case 15:        // after setting thermometer

            HandleCameraStatus();

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);
            //allow burner controller to work
            // ObjectsInGame[5].GetComponent<BurnerHandler>().EnableBurnerOnOffBtn();

            //once burner turn - on
            //start temperature increasing if burner is on
            //start temperature decreasing if burner is off

            //Turn on burner
            insCont.IncInsIndex();

            break;

        case 16:        //bunsen burner call me, first time on, idr water boiling, plz you strt setting up polystyrene setup,

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            HandleCameraStatus();

            //update next scene
            StartCoroutine(UpdatePSetupScene(1f));

            break;

        case 17:            //after pwooden for pwater cup,
        case 18:            //after pwater for pthermometer

            //SetIgnoreRayCastLayer(ObjectsInGame[CurrentGameObjectIndex]);
            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            //increment next shadow
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            HandleCameraStatus();

            break;

        case 19:        //p thermometer set after....

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);
            //StopMovement(ObjectsInGame[CurrentGameObjectIndex]);

            // SetIgnoreRayCastLayer(ObjectsInGame[CurrentGameObjectIndex]);


            //ObjectsInGame[CurrentGameObjectIndex].transform.SetParent(GameObject.FindGameObjectWithTag("HorizontalMovableRod").transform);

            GameObject Child  = ObjectsInGame[CurrentGameObjectIndex];
            GameObject Parent = GameObject.FindGameObjectWithTag("HorizontalMovableRod");

            if (Child && Parent)
            {
                SetMyParent(Child.transform, Parent.transform);
            }
            else
            {
                Debug.LogError("Child or Parent not found: ");
            }
            Debug.Log("my parent is set ");

            //rod move up and down enable
            //ObjectsInGame[8].GetComponentInChildren<HorizontalRodHandler>().EnableHorizontalRodBtn();
            ObjectsInGame[8].GetComponentInChildren <DirectionalPointersHandler>().ActivatePointer1FirstTime();
            //ObjectsInGame[8].GetComponentInChildren<MovementController>().EnableMovingDownWithoutBob();

            //adjust thermo 1 cm above the cup
            insCont.IncInsIndex();

            break;

        case 20:        //plz submit initial temperature

            HandleCameraStatus();

            //pthermometer, temperature increase if in cup, back to normal if outside
            //once submit temperature, rod must be outside cup and stop rod movement up and down
            //if bob temperature, and submit cup temperature, then show hanger next shadow

            //once attached to exact position, same if in cup, thermo temperature calculated
            //and rise else back to normal room temperature

            //initial temperature water button:
            //WaterTempButtonsHandler.WaterTempButtonsHandlerInstance.EnableInitialTempField();

            insCont.IncInsIndex();

            StartCoroutine(WaitAndForcefullyZoomInPoly(8f));            //stay at zoom in mode...
            StartCoroutine(EnableForcefullyZoomInPolyButton(9f));


            break;

        case 21:        //initial temp submission call me

            HandleCameraStatus();

            //ObjectsInGame[8].GetComponentInChildren<HorizontalRodHandler>().EnableHorizontalRodBtn();

            //ObjectsInGame[8].GetComponentInChildren<MovementController>().EnableLastTimePointer2Activated();

            ObjectsInGame[8].GetComponentInChildren <DirectionalPointersHandler>().ActivatePointer2LastTime();

            //now observe the boiling water
            //enable time forward button
            //if left time, also set moving camera position towards boiling apparatus

            //adjust thermo and take out from water
            insCont.IncInsIndex();

            break;

        case 22:        // LastTimePointer2Activated in movement controller, horizonal rod object called me, after submitted initial temperature

            //HandleCameraStatus();

            //now observe the boiling water
            //enable time forward button
            //if left time, also set moving camera position towards boiling apparatus

            Debug.Log("Observer the water to boil");

            // observe boiling water
            insCont.IncInsIndex();

            //ObjectsInGame[7].GetComponentInChildren<AfterBoilingEffectsHandler>().SetPolystyreneWorkCompleted();

            StartCoroutine(WaitAndForcefullyZoomIn(8f));            //stay at zoom in mode...


            break;

        case 23:        //if boiling water reached to 100 degree temperature, (after boiling effects handler) call me

            StartCoroutine(EnableForcefullyZoomInBeakerButton(1f));
            HandleCameraStatus();

            Debug.Log("boiling reached to 100 degree");

            //start water level decreasing in the beaker

            //increment next shadow for bob hanger
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            //record the temperature of boiling water
            insCont.IncInsIndex();

            //bob ko beaker me place krdia jaye ga...

            break;

        case 24:        //guidance call me // hanger heated collided

            HandleCameraStatus();

            Debug.Log("strt the timer count");

            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            insCont.IncInsIndex();                    //place bob for 10 mins

            StartCoroutine(WaitForCounterStarts(1f)); //counter strt ho gya yaha pe..

            //also boiling input field will appear  //accept temperature if 10 mins passed...


            StartCoroutine(WaitAndForcefullyZoomIn(8f));            //stay at zoom in mode...
            StartCoroutine(EnableForcefullyZoomInBeakerButton(9f));

            break;

        //after 2 sec of counter starts, forcefully zoom in button called.. and disable it...



        case 25:        //count down timer call me

            //button enabled for heated water temp submission
            //WaterTempButtonsHandler.WaterTempButtonsHandlerInstance.EnableHeatedBobTempField();

            //this.GetComponent<CountDownTimerHandler>().DisableTimer();

            //record boiling water temperature
            insCont.IncInsIndex();        //submit bob temperature

            HandleCameraStatus();

            break;

        case 26:        //submit bob temp button call me from water temp button handler

            HandleCameraStatus();

            //next hanger bob shadow enabled on polystyrene cup..
            //increment next shadow for bob hanger
            sHand.UpdateGuidanceObject();

            //ObjectsInGame[11].GetComponent<MovementHandler>().enabled = true;
            //ObjectsInGame[11].GetComponent<MovementHandler>().SetFirstTimeIAmReachedToDestinationStatus(false);

            ////ObjectsInGame[11].GetComponent<StopMovementHandler>().enabled = true;

            ////ObjectsInGame[11].GetComponent<PositionHandler>().CallFixedUpdate();

            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<MovementHandler>().enabled = true;

            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<MovementHandler>().SetFirstTimeIAmReachedToDestinationStatus(false);
            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<StopMovementHandler>().enabled = true;

            ObjectsInGame[CurrentGameObjectIndex].layer = 0;

            //quickly transfer bob
            insCont.IncInsIndex();

            break;

        case 27:        //guidance handler call me

            HandleCameraStatus();

            // SetIgnoreRayCastLayer(ObjectsInGame[CurrentGameObjectIndex]);
            IgnoreRayCast(ObjectsInGame[CurrentGameObjectIndex]);

            Debug.Log("hanger attached to polystyrene stand rod");

            GameObject ChildHangerP  = ObjectsInGame[CurrentGameObjectIndex];
            GameObject ParentHangerP = GameObject.FindGameObjectWithTag("HorizontalMovableRod");
            //ObjectsInGame[CurrentGameObjectIndex].GetComponent<StopMovementHandler>().enabled = true;

            if (ChildHangerP && ParentHangerP)
            {
                SetMyParent(ChildHangerP.transform, ParentHangerP.transform);
            }
            else
            {
                Debug.LogError("Child or Parent not found: ");
            }
            Debug.Log("my parent is set ");

            //enable horizontal rod button to go down for as first time moving down

            //ObjectsInGame[8].GetComponentInChildren<MovementController>().SetMovingDownWithBobHanger();
            //ObjectsInGame[8].GetComponentInChildren<MovementController>().SetFirstTimePointerActivated();

            //ObjectsInGame[8].GetComponentInChildren<HorizontalRodHandler>().EnableHorizontalRodBtn();

            ObjectsInGame[8].GetComponentInChildren <DirectionalPointersHandler>().ActivatePointer1FirstTime();


            //turn off bunsen burner
            //ObjectsInGame[5].GetComponent<BurnerHandler>().OnClickBurnerOnOffBtn();
            DisableForcefullyZoomInBeakerButton();
            HandleCameraStatus();

            //Adjust the thermometer into cup
            insCont.IncInsIndex();

            break;

        case 28:        //MovementController call me...  move down with bob hanger

            //steam come when bob collide with cold water for few seconds
            //    ObjectsInGame[9].GetComponentInChildren<ParticleSystem>().Play();

            HandleCameraStatus();

            //if get time:   calculate final temperature:
            //set thermometer final temperature to set on:

            //cover the cup with lid:

            //increment next shadow for bob hanger
            sHand.UpdateGuidanceObject();

            //deactivate next inventory panel to work
            uiHand.UpdateNextInventoryItem(CurrentGameObjectIndex);

            //cover cup
            insCont.IncInsIndex();

            // StartCoroutine(WaitForCupCap(0.5f));

            break;

        case 29:        //guidance controller call me: cup cap placed

            //HandleCameraStatus();

            StartCoroutine(WaitAndForcefullyZoomInPoly(8f));            //stay at zoom in mode...
            StartCoroutine(EnableForcefullyZoomInPolyButton(9f));

            stir();

            break;

        case 30:        //water temp button handler, on submit final temp called me

            //you are moving towards observation panel, well done;

            HandleCameraStatus();

            StartCoroutine(EnableForcefullyZoomInPolyButton(2f));

            StartCoroutine(ClosingSceneWait(4f));

            ActivateMe(CompletedPanel);

            if (sfx != null)
            {
                sfx.PlaySound("snap_s");
            }

            break;
        }
    }