コード例 #1
0
 // GameManager_Scoring should be a singleton
 public static GameManager_Scoring GetInstance()
 {
     if (instance == null)
     {
         instance = new GameManager_Scoring();
     }
     return(instance);
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        GameScore = GameManager_Scoring.GetInstance().GetGameScore();


        currentTimer -= Time.deltaTime;

        // Update the sprite size
        HPBarSpriteRenderer.size = new Vector2(HPBarSpriteInitialWidth * currentTimer / GameRoundTime, HPBarSpriteInitialHeight);
        if (currentTimer <= 0.0)
        {
            currentTimer = 0.0f;
        }

        TextMeshObject.text = "Nostalgia Points: " + string.Format("{0:N0}", GameScore); //+ "\nCountdown: " + string.Format("{0:N0}", currentTimer)
    }
コード例 #3
0
    public void OnAction()
    {
        // Only change the score if ActionCalled was initially off
        if (ActionCalled == false)
        {
            GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue);
        }

        // Action to be called by the operator
        // When the action is called, it will apply a force to the plate
        ActionCalled = true;

        GetComponent <Rigidbody>().AddRelativeForce(ForceVector);

        SoundManager.instance.RandomizeSfx(actionSound1, actionSound2);
    }
コード例 #4
0
    // Action to be called by the operator
    // When the action is called, it will apply a force to the plate
    public void OnAction()
    {
        // Only change the score if ActionCalled was initially off
        if (ActionCalled == false)
        {
            GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue);
        }

        ActionCalled = true;

        Vector3 Force    = new Vector3(0.0f, 30.0f, 0.0f);
        Vector3 Position = new Vector3(0.75f, 0.0f, 0.75f);

        TableRigidBody.AddForceAtPosition(Force, Position);

        SoundManager.instance.RandomizeSfx(actionSound1, actionSound2);
    }
コード例 #5
0
    public void OnAction()
    {
        // Put in OnAction() function
        SoundManager.instance.PlayLoop(LoopSound);
        SoundManager.instance.RandomizeSfx(actionSound1, actionSound2);

        // Only change the score if ActionCalled was initially off
        if (ActionCalled == false)
        {
            GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue);
        }

        // Action to be called by the operator
        ActionCalled = true;

        // Trigger the particle emitter
        ParticleObject.SetActive(true);
    }
コード例 #6
0
    public void OnAction()
    {
        // Each time action is called, decrease the health of the object
        if (ObjectHealth > 0)
        {
            // Update the object health
            ObjectHealth--;

            // Update the sprite size
            HPBarSpriteRenderer.size = new Vector2(HPBarSpriteInitialWidth * ObjectHealth / ObjectInitialHealth, HPBarSpriteInitialHeight);

            if (ObjectHealth <= (0.25 * ObjectInitialHealth))
            {
                HPBarSpriteRenderer.color = Color.red;
            }

            // Update the text of the text box
            TextMeshObject.text = string.Format("{0:N0}", ObjectHealth) + " NP";
        }

        if (ObjectHealth == 0)
        {
            // Only change the score if ActionCalled was initially off
            if (ActionCalled == false)
            {
                GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue);
            }

            // Action to be called by the operator
            ActionCalled = true;

            // Trigger the particle emitter
            ParticleObject.SetActive(false);
            ParticleObject.SetActive(true);

            // Trigger sound file
            SoundManager.instance.RandomizeSfx(actionSound);
        }
    }
コード例 #7
0
ファイル: SceneMgr.cs プロジェクト: antoinetd/gamejam-cml
    private void Update()
    {
        currentTimer -= Time.deltaTime;
        if (doSwitch && currentTimer < 0f && !credit)
        {
            credit = true;
            SceneManager.LoadScene("CreditsScreen");
        }
        if ((Input.GetButtonDown("ChangeToParent") || currentTimer < 0f) && doSwitch == false)
        {
            KidControls kidControls = (KidControls)FindObjectOfType(typeof(KidControls));
            // If we are already in parent mode do nothing
            if (kidControls.recording == false && kidControls.replaying == true)
            {
                return;
            }

            history_backup = new List <KidControls.SimpleTransform>();
            foreach (KidControls.SimpleTransform item in kidControls.history)
            {
                history_backup.Add(item);
            }
            Scene scene = SceneManager.GetActiveScene();
            SceneManager.LoadScene(scene.name);

            doSwitch     = true;
            currentTimer = 120f;
        }

        if (doSwitch)
        {
            frameCounter++;
        }

        if (frameCounter == 10)
        {
            currentTimer = 120f;
            KidControls kidControls = (KidControls)FindObjectOfType(typeof(KidControls));

            KidControls          kidControlsNewScene = (KidControls)FindObjectOfType(typeof(KidControls));
            ParentManualControls parentControls      = (ParentManualControls)FindObjectOfType(typeof(ParentManualControls));
            AI_Ctrl ai_ctrl = (AI_Ctrl)FindObjectOfType(typeof(AI_Ctrl));

            if (kidControlsNewScene != null)
            {
                kidControls.history           = history_backup;
                kidControlsNewScene.recording = false;
                kidControlsNewScene.replaying = true;
            }
            if (parentControls != null)
            {
                parentControls.activateManualControls = true;
                var navMesh = parentControls.gameObject.GetComponent <NavMeshAgent>();
                if (navMesh != null)
                {
                    navMesh.enabled = false;
                }
            }
            if (ai_ctrl != null)
            {
                ai_ctrl.enableParent = false;
                var bc = ai_ctrl.GetComponent <BoxCollider>();
                if (bc != null)
                {
                    bc.enabled = true;
                }
                var cc = ai_ctrl.GetComponent <CapsuleCollider>();
                if (cc != null)
                {
                    cc.enabled = true;
                }
            }
            GameManager_Scoring.GetInstance().isAdult = true;
        }
    }