Inheritance: MonoBehaviour
    // Use this for initialization
    void Start()
    {
        player           = GameObject.FindWithTag("Player").transform;
        playerMoveScript = player.GetComponent <PlayerLookMove> ();

        if (playerMoveScript != null)
        {
            originalVelocity = playerMoveScript.velocity;
        }

        pPV = GetComponent <PostProcessingBehaviour>().profile;
    }
    IEnumerator SetCollectorPlayerSpeed(GameObject GOtoDestroy)
    {
        PlayerLookMove coll = player.GetComponent <PlayerLookMove>();
        //	playerManager = player.GetComponent<PlayerManager>();

        float CurrentVelocity = coll.velocity;

        coll.velocity = 60;

        //coll.velocity = 10;
        //Does not switch back?

        yield return(new WaitForSeconds(4f));

        Debug.Log("slow player");

        coll.velocity = CurrentVelocity;

        Destroy(GOtoDestroy);
    }
Example #3
0
    IEnumerator Start()
    {
        //gInteraction = interactionTextGO.GetComponent<GeneralInteraction> ();
        playerLookMove = GameObject.FindWithTag("Player").GetComponent <PlayerLookMove> ();

        if (playerLookMove != null)
        {
            originalRechargeTime            = playerLookMove.jumpRechargeTime;
            playerLookMove.jumpRechargeTime = Mathf.Infinity;
        }

        armStressMenuForEnabled.SetActive(false);
        feetForEnabled.SetActive(false);
        //doesnt store dynamic value
        //	canWalk = GameObject.FindWithTag ("Player").GetComponent<PlayerLookMove> ().enabled;

        while (true)
        {
            //	Debug.Log ("THIS IS TEXT SPEECH" + textSpeech);
            yield return(null);

            if (uIHelpGO != null)
            {
                if (isFirstTime)
                {
                    counter     = 0;
                    isFirstTime = false;
                }
                counter += Time.unscaledDeltaTime;
                if (isUsingSprite)
                {
                    Color tempColor = spriteHelp.color;
                    tempColor.a = Mathf.PingPong((counter * fadingSpeed) * fadingSpeed, 1);

                    spriteHelp.color = tempColor;
                }
                else if (isUsingTextMesh)
                {
                    Color tempColor = textMeshHelp.color;
                    tempColor.a = Mathf.PingPong((counter * fadingSpeed) * fadingSpeed, 1);

                    textMeshHelp.color = tempColor;
                }

                switch (curGoal)
                {
                case Goal.CONTINUE_TEXT_BUTTON:

                    if (isContinueButtonPressed)
                    {
                        TimeLineController.Instance.ResumeTimeLine();

                        curGoal = Goal.NONE;

                        isContinueButtonPressed = false;
                    }

                    break;

                case Goal.OPENMENU:

                    if (!armStressMenuForEnabled.activeInHierarchy)
                    {
                        armStressMenuForEnabled.SetActive(true);
                    }
                    else
                    {
                        //USE SCRIPTABLE CHECKER
                        yield return(null);
//						if (GameController.Instance.IsMenuActive) {
//
//							TurnOffHelpInfo ();
//							curGoal = Goal.NONE;
//
//						}
                    }
                    break;

                case Goal.CLICK_COPING:

                    if (copingGOCheckForEnabled.activeInHierarchy)
                    {
                        TurnOffHelpInfo();
                        curGoal = Goal.NONE;
                    }

                    break;

                case Goal.WALK:
                    if (!feetForEnabled.activeInHierarchy)
                    {
                        feetForEnabled.SetActive(true);
                    }
                    else
                    {
                        //USE SCRIPTABLE CHECKER
                        //if(!GameController.Instance.IsMenuActive)
                        if (GameObject.FindWithTag("Player").GetComponent <PlayerLookMove> ().enabled)
                        {
                            TurnOffHelpInfo();

                            //curGoal = Goal.NONE;
                        }
                    }

                    break;

                case Goal.JUMP:

                    if (playerLookMove.jumpRechargeTime == Mathf.Infinity)
                    {
                        playerLookMove.jumpRechargeTime = originalRechargeTime;
                    }
                    else
                    {
                        if (playerLookMove.isGoingUp)
                        {
                            TurnOffHelpInfo();
                        }
                    }



                    break;

                case Goal.CLICK_ACTION:
                    break;

                case Goal.CLICK_INFORMATION:
                    break;

                case Goal.WAITEXPLANATION:

                    TurnOffHelpInfo();
                    curGoal = Goal.NONE;

                    break;

                case Goal.WAITFORTIMELINE:

                    //if (isFirstTime)
                    //	explanationPlayable.Play ();

                    if (explanationPlayable.duration <= explanationPlayable.time)
                    {
                        TurnOffHelpInfo();
                        TimeLineController.Instance.ResumeTimeLine();

                        curGoal = Goal.NONE;
                    }
                    break;

                case Goal.NONE:
                    break;
                }
            }
        }
    }