IEnumerator mapPlacer()
    {
        EventDriver eventDrivers = GameObject.FindObjectOfType <EventDriver>();

        enemyLeader = eventDrivers.FindParty();

        MCMove mcMove = GameObject.FindObjectOfType <MCMove>();

        enemyUnitParty  = GameObject.Find(enemyLeader).gameObject.GetComponent <UnitParty>();
        playerUnitParty = mcMove.gameObject.GetComponent <UnitParty>();
        List <string> newEnemyLocations  = CalcQuadEnemy();
        List <string> newPlayerLocations = CalcQuadPlayer();


        for (int j = 0; j < enemyUnitParty.enemyUnits.Count; j++)
        {
            Instantiate(enemyUnitParty.enemyUnits[j], GameObject.Find(newEnemyLocations[j]).transform.position + new Vector3(0, 1.4f, 0), setQuaterRotation(0, 0, 0));
            enemyUnitParty.enemyUnits[j].GetComponent <Stats>().levelBoost = enemyUnitParty.levelUP;
        }

        for (int i = 0; i < playerUnitParty.friendlyUnits.Count; i++)
        {
            Instantiate(playerUnitParty.friendlyUnits[i], GameObject.Find(newPlayerLocations[i]).transform.position + new Vector3(0, 1.4f, 0), setQuaterRotation(0, 0, 0));
        }
        goodGo = false;
        yield return(new WaitForSeconds(0.5f));

        gameObject.GetComponent <SpeedCenterTurns>().Ordering();
    }
Пример #2
0
    void Awake()
    {
        Debug.Log("Awake called");
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        player          = GameObject.Find("Player");
        mcHammer        = GameObject.Find("MC Hammer");
        levelImage      = GameObject.Find("LevelImage");
        levelText       = GameObject.Find("LevelText").GetComponent <Text>();
        playAgainButton = GameObject.Find("PlayAgainButton");
        giveUpButton    = GameObject.Find("GiveUpButton");

        DancerSpawner = GameObject.Find("BG Spawner").GetComponent <CreateDancer>();
        HammerSpawner = GameObject.Find("HammerSpawner").GetComponent <HammerSpawn>();
        PopperSpawner = GameObject.Find("Popper Spawner").GetComponent <PopperSpawner>();
        RocketSpawner = GameObject.Find("RocketSpawner").GetComponent <RocketSpawner>();
        MCMove        = GameObject.Find("MC Hammer").GetComponent <MCMove>();

        //SCORE - get the score text UI
        scoreUITextGO  = GameObject.FindGameObjectWithTag("ScoreTextTag");
        scoreUITextGO2 = GameObject.FindGameObjectWithTag("ScoreText2Tag");
        scoreUITextGO3 = GameObject.FindGameObjectWithTag("ScoreHiTextTag");
        imgNewGO       = GameObject.Find("NEW");

        //SCORE - initialize
        scoreUITextGO.GetComponent <GameScore>().Score = 0;
        //SCORE - hide hiscore features
        imgNewGO.SetActive(false);


        levelImage.SetActive(false);
        playAgainButton.SetActive(false);
        giveUpButton.SetActive(false);

        level = 1;
        InitGame();
    }
Пример #3
0
 void Start()
 {
     mc = GameObject.Find("MC Hammer").GetComponent <MCMove>();
     gm = GameObject.Find("GameManager").GetComponent <GameManager>();
     Reset();
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     mc = GameObject.Find("MC Hammer").GetComponent <MCMove>();
     v  = transform.position - center.position;
 }