private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    void OnTriggerEnter2D(Collider2D collider)
    {
        // Try and find the 'ScoreText' GameObject
        GameObject scoreTextObject = GameObject.Find("ScoreText");

        if (scoreTextObject)
        {
            // Get the Text component from the GameObject
            Text scoreTextComponent = scoreTextObject.GetComponent <Text>();

            // Update our score variable
            score += 10f;

            // Set the text of the 'ScoreText' GameObject to display the score
            scoreTextComponent.text = "Score: " + score;
        }

        // Now that we have updated out score and out ScoreText - we can delete the trigger
        Destroy(collider.gameObject);



        // Try and find the EndGameWatcher GameObject
        GameObject endGameManager = GameObject.Find("EndGameWatcher");

        // Make sure it exists or the next couple of lines will crash the game
        if (endGameManager)
        {
            // Get the script from the EndGameWatcher
            EndGameController endGameScript = endGameManager.GetComponent <EndGameController>();

            // Tell the script the a pickup has been recieved
            endGameScript.OnPickupRecieved();
        }
    }
Beispiel #3
0
 // Called 0th
 // Set references
 private void Awake()
 {
     // Set up singleton
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Debug.LogError("Cannot have multiple EndGameContollers in the scene");
         Destroy(this.gameObject);
     }
 }
Beispiel #4
0
    private void Start()
    {
        coinTextBox.SetActive(false);

        mainCharInv      = MainCharInventory.Instance;
        hotbarCont       = HotbarController.Instance;
        dialogCont       = DialogController.Instance;
        storeCont        = WebStoreController.Instance;
        mainCharCont     = MainCharacterController.Instance;
        settingsCont     = SettingsController.Instance;
        nightCont        = NightController.Instance;
        forestCanvasCont = ForestCanvasController.Instance;
        timeSystem       = TimeSystem.Instance;
        endGameCont      = EndGameController.Instance;
    }
Beispiel #5
0
    void Awake()
    {
        timer = 0F;
        moves = 0;

        numpad       = FindObjectOfType <numpadController>();
        checkButton  = FindObjectOfType <checkButtonController>();
        arena        = FindObjectOfType <arenaManager>();
        endGamePanel = FindObjectOfType <EndGameController>();
        audio        = FindObjectOfType <audioController>();

        timerTxt = GameObject.FindGameObjectWithTag("Timer display").gameObject.GetComponent <Text>();
        movesTxt = GameObject.FindGameObjectWithTag("Moves display").gameObject.GetComponent <Text>();

        numpad.gameObject.SetActive(false);
        endGamePanel.setActive(false);
        checkButton.deactivate();

        LevelManager.Load();
    }
Beispiel #6
0
	void Awake()
    {
        timer = 0F;
        moves = 0;

        numpad = FindObjectOfType<numpadController>();
        checkButton = FindObjectOfType<checkButtonController>();
        arena = FindObjectOfType<arenaManager>();
        endGamePanel = FindObjectOfType<EndGameController>();
        audio = FindObjectOfType<audioController>();

        timerTxt = GameObject.FindGameObjectWithTag("Timer display").gameObject.GetComponent<Text>();
        movesTxt = GameObject.FindGameObjectWithTag("Moves display").gameObject.GetComponent<Text>();
        
        numpad.gameObject.SetActive(false);
        endGamePanel.setActive(false);
        checkButton.deactivate();

        LevelManager.Load();
    }
Beispiel #7
0
 private void Awake()
 {
     _playerData = new CharacterData();
     _playerData.CurrentPosition = transform.position;
     _isReceivingDamage          = false;
     _isFalling      = false;
     _canAttack      = true;
     _whereIsLooking = 1;
     _gameManager    = null;
     attackCheck.SetActive(false);
     _coroutineActiveAttack     = CoroutineActiveAttack();
     _coroutineActiveRBAddForce = CoroutineActiveRBAddForce(0, 0, 0);
     _myRb              = GetComponentInChildren <Rigidbody2D>();
     _myCollider        = GetComponent <CapsuleCollider2D>();
     animatorController = new AnimatorController(GetComponentInChildren <Animator>());
     _sceneManager      = FindObjectOfType <SceneManagement>();
     _gameManager       = FindObjectOfType <GameManager>();
     _endGameController = FindObjectOfType <EndGameController>();
     _soundController   = FindObjectOfType <SoundController>();
     PreparePlayer(_playerData);
 }
    void Start()
    {
        if (EndGameControl == null)
        {
            EndGameControl = this;
        }
        else
        {
            Destroy(gameObject);
        }

        audioSrc         = GetComponent <AudioSource>();
        Cursor.visible   = true;
        Cursor.lockState = CursorLockMode.None;
        LoadDernierScore();

        try
        {
            LoadMeilleurScore();
            hasAHighScore = true;
        }
        catch (Exception)
        {
            hasAHighScore    = false;
            bestTimeToFinish = 0.00f;
        }

        if (hasAHighScore)
        {
            isScoreBeat();
        }
        else
        {
            addHighScore();
            SaveFirstScore();
        }
    }
Beispiel #9
0
 private void Awake()
 {
     instance = this;
 }
Beispiel #10
0
 private void Awake()
 {
     Instance = this;
     gameObject.SetActive(false);
 }
Beispiel #11
0
    // Update is called once per frame
    void Update()
    {
        // How dead is the player?
        float t = Time.time - startTime;         // Time in seconds since start

        // Compute cost
        if (playerController.canCast)           // not in the oasis
        {
            totalCost   += Time.deltaTime * costPerSecond;
            totalCost   += costPerMeter * (transform.position - prevPosition).magnitude;
            prevPosition = transform.position;
        }

        // POST-PROCESSING EFFECTS
        // Set post-processing effects

        const float blackoutTime = 2.0f;

        float deadness = totalCost / len;
        //float deadness = Mathf.Max(0.0f, t-blackoutTime) / len;

        // Speed up deadness towards the end
        // deadness *= deadness; // actually don't

        // ramp up exposure a lot in the last second
        float dt = Mathf.Max(0.0f, (deadness - (len - 3.0f) / len) * len / 3.0f);
        float t2 = deadness + 4 * dt * dt * dt * dt;

        // Color grading cues
        VignetteModel.Settings vm = profile.vignette.settings;
        vm.intensity = 0.297f * (deadness - dt * dt);     //deadness;
        profile.vignette.settings = vm;

        GrainModel.Settings gs = profile.grain.settings;
        gs.intensity           = 1 * deadness;
        profile.grain.settings = gs;

        ColorGradingModel.Settings cgs = profile.colorGrading.settings;

        // On the first iteration, fade in; on subsequent ones, blackout the first two seconds.
        if (t < blackoutTime)
        {
            if (iter == 0)
            {
                cgs.basic.postExposure = 0.0f + Mathf.Log(Mathf.Max(0.0f, t / 2.0f)) / Mathf.Log(2.0f);
            }
            else
            {
                cgs.basic.postExposure = -200.0f;
            }
            canPlaySounds = false;
        }
        else
        {
            // Normal behavior
            cgs.basic.postExposure = 0.0f + 1.19f * t2;
            canPlaySounds          = true;
        }
        cgs.basic.temperature         = 4.98f + 46.0f * deadness;
        profile.colorGrading.settings = cgs;

        directionalSun.intensity = 1.0f + 64.0f * dt * dt * dt * dt;        ///*1.0f +*/ Mathf.Pow(2.0f, 8.0f*dt * dt * dt);
        // END POST-PROCESSING EFFECTS

        // Title text
        if (iter == 0)
        {
            // disappear from seconds 2 to 4
            titleImage.color = new Color(1.0f, 1.0f, 1.0f, Mathf.Clamp(1.0f - (t - 2.0f) / 2.0f, 0.0f, 1.0f));
            if (t > 4.0f)
            {
                titleImage.enabled = false;
            }
            else
            {
                titleImage.enabled = true;
            }
        }
        else
        {
            titleImage.enabled = false;
        }


        // Number text
        numberText.enabled = ((iter > 0) && (t < 2.0f));
        if (iter > 0)
        {
            numberText.text = iter.ToString();
        }

        // If we're ending, don't allow restarts
        if (timeToEnd < 0.0f)
        {
            // Are we at the end of this runthrough?
            if (deadness > 1.0f)
            {
                iter++;
                PlayerController pc = GetComponent <PlayerController> ();
                pc.audioSource.Stop();
                pc.treasureSource.Stop();
                ResetPlaythrough();
            }
        }
        else
        {
            // Ending
            // What should the level of the visuals be?
            float et = timeToEnd / fadeOutLength;
            et  = -2 * et * et * et + 3 * et * et; // cubic Hermite spline
            cgs = profile.colorGrading.settings;
            cgs.basic.postExposure        = Mathf.Lerp(cgs.basic.postExposure, Mathf.Log(t) / Mathf.Log(2.0f), Time.deltaTime);
            profile.colorGrading.settings = cgs;

            timeToEnd -= Time.deltaTime;

            Debug.Log(timeToEnd);

            if (timeToEnd > fadeOutLength)
            {
                EndGameController egc = GetComponent <EndGameController> ();
                egc.EndGame();
            }
        }
    }
Beispiel #12
0
 private void EndGame()
 {
     section.RemoveAllSections();
     ViewController.RemoveAllViewes();
     EndGameController endGame = new EndGameController(player.GetScore());
 }
Beispiel #13
0
 public void InitializeState()
 {
     _controller = new EndGameController();
 }
Beispiel #14
0
 public void FinalizeState()
 {
     _controller = null;
 }