示例#1
0
    private void Start()
    {
        DifficultyController difficultyController = FindObjectOfType <DifficultyController>();
        Difficulty           difficulty           = difficultyController.getDifficulty();

        health = Mathf.RoundToInt(health * difficulty.getHealthScaling());
        onPlayerBaseDamaged.Invoke(health);
    }
示例#2
0
    private void Awake()
    {
        LevelController levelController = FindObjectOfType <LevelController>();

        levelController.addEnemy();

        Damagable damagable = GetComponent <Damagable>();

        damagable?.registerOnKilled(() => levelController.removeEnemy());

        DifficultyController difficultyController = FindObjectOfType <DifficultyController>();
        Difficulty           difficulty           = difficultyController.getDifficulty();
        Walker walker = GetComponent <Walker>();

        walker?.setWalkSpeed(walker.getWalkSpeed() * difficulty.getEnemySpeedScaling());
    }
示例#3
0
    private void Start()
    {
        defendersParent = GameObject.Find(DEFENDER_PARENT_NAME) ?? new GameObject(DEFENDER_PARENT_NAME);

        DifficultyController difficultyController = FindObjectOfType <DifficultyController>();
        Difficulty           difficulty           = difficultyController.getDifficulty();

        stars = Mathf.RoundToInt(stars * difficulty.getStartingStarAmountScaling());
        onStarAmountUpdated.Invoke(stars);

        foreach (DefenderIcon defenderIcon in FindObjectsOfType <DefenderIcon>())
        {
            defenderIcon.registerOnDefenderSelected((selectedDefender) => setDefender(selectedDefender));
        }
        onStarGeneration.AddListener((amount) => addStars(amount));
    }
示例#4
0
    void Start()
    {
        correctText        = GameObject.Find("Correct").GetComponent <Text> ();
        missedText         = GameObject.Find("Missed").GetComponent <Text> ();
        timerText          = GameObject.Find("Timer").GetComponent <Text> ();
        scoreText          = GameObject.Find("Score").GetComponent <Text> ();
        stateText          = GameObject.Find("StateText").GetComponent <Text> ();
        incorrectStateText = GameObject.Find("Text_IncorrectState").GetComponent <Text> ();
        totalTimeText      = GameObject.Find("Text_TotalTime").GetComponent <Text> ();
        WorldMap           = GameObject.Find("World Map");
        USA          = GameObject.Find("USA State Map");
        Europe       = GameObject.Find("Europe Map");
        Africa       = GameObject.Find("Africa Map");
        Asia         = GameObject.Find("Asia Map");
        LatinAmerica = GameObject.Find("Latin America Map");
        MiddleEast   = GameObject.Find("Middle East Map");

        UIPanel_Bottom    = GameObject.Find("UIPanel_Bottom");
        UIPanel_Top       = GameObject.Find("UIPanel_Top");
        Button_Confirm    = GameObject.Find("Button_Confirm");
        Pointer           = GameObject.Find("Pointer");
        button_newgame    = GameObject.Find("Button_NewGame");
        button_resume     = GameObject.Find("Button_Resume");
        button_restart    = GameObject.Find("Button_Restart");
        button_mainmenu   = GameObject.Find("Button_MainMenu");
        button_options    = GameObject.Find("Button_Options");
        correct_indicator = GameObject.Find("Correct_Indicator");
        miss_indicator    = GameObject.Find("Miss_Indicator");
        sound_correct     = GameObject.Find("Sound_Correct");
        sound_miss        = GameObject.Find("Sound_Miss");
        sound_victory     = GameObject.Find("Sound_Victory");

        correct     = 0;
        missed      = 0;
        stateIndex  = 0;
        missedIndex = 0;
        missedFlag  = false;
        correctFlag = false;
        score       = 0;
        isGameOver  = false;
        totalTime   = 0;
        blinkFlag   = false;
        isPaused    = false;

        region     = MainMenuController.getRegion();
        difficulty = DifficultyController.getDifficulty();

        resetTimeLeft();
        resetMissDelay();
        resetCorrectDelay();
        resetBlinkTimer();

        button_newgame.SetActive(false);          // needs to be instantiated and assigned to a variable so that I can use SetActive()
        button_mainmenu.SetActive(false);
        button_options.SetActive(false);
        button_resume.SetActive(false);
        button_restart.SetActive(false);
        correct_indicator.SetActive(false);
        miss_indicator.SetActive(false);
        totalTimeText.text = "";

        setActiveRegion();
        setStateList();
        stateCount = stateList.Count;

        loadGameState();

        SelectStateRandomly();
    }