SetupScene() public method

public SetupScene ( int level ) : void
level int
return void
示例#1
0
    void Awake()
    {
        // Enforce singleton-ness
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);

        boardManager = GetComponent<BoardManager> ();
        boardManager.SetupScene ();
    }
示例#2
0
    void InitGame()
    {
        if (instance != null)
        {
            instance.enemies.Clear();
        }
        else
        {
            enemies.Clear();
        }

        FloorNumberText      = GameObject.Find("FloorNumberText").GetComponent <Text>();
        FloorNumberText.text = "Floor " + level;

        PlayerLevelText      = GameObject.Find("PlayerLevelText").GetComponent <Text>();
        PlayerLevelText.text = "Level " + playerLevel;

        HealthText      = GameObject.Find("HealthText").GetComponent <Text>();
        HealthText.text = "Health:  " + playerCurrentHealth;

        StaminaText      = GameObject.Find("StaminaText").GetComponent <Text>();
        StaminaText.text = "Stamina:  " + playerCurrentStamina;

        ScoreText      = GameObject.Find("ScoreText").GetComponent <Text>();
        ScoreText.text = "Score:  " + playerPoints;

        levelWalls   = boardScript.SetupScene(level);
        PlayerObject = GameObject.FindWithTag("Player");
        PlayerObject.transform.position = BoardManager.entrance;

        DontDestroyOnLoad(FloorNumberText);
        DontDestroyOnLoad(PlayerLevelText);
        DontDestroyOnLoad(HealthText);
        DontDestroyOnLoad(StaminaText);
        DontDestroyOnLoad(ScoreText);

        occupiedSpots.Clear();
    }
示例#3
0
    void InitGame()
    {
        doingSetup = true;

#if !(UNITY_STANDALONE || UNITY_WEBGL)
        Text restartButtonText = GameObject.Find("LevelText").GetComponent <Text>();
        restartButtonText.text = "Touch me to Restart";
#endif

        levelImage     = GameObject.Find("LevelImage");
        restartButton  = GameObject.Find("RestartButton");
        levelText      = GameObject.Find("LevelText").GetComponent <Text>();
        levelText.text = "Day " + level;

        restartButton.SetActive(false);
        levelImage.SetActive(true);


        enemies.Clear();
        boardScript.SetupScene(level);

        Invoke("HideLevelImage", levelStartDelay);
    }
示例#4
0
    void InitGame()
    {
        doingSetup = true;

        levelImage = GameObject.Find("LevelImage");


        levelText = GameObject.Find("LevelText").GetComponent <Text>();

        levelText.text = "Day " + level;


        levelImage.SetActive(true);


        Invoke("HideLevelImage", levelStartDelay);


        enemies.Clear();


        boardScript.SetupScene(level);
    }
示例#5
0
    //Initializes the game for each level.
    void InitGame()
    {
        //Get a reference to our image LevelImage by finding it by name.
        //  levelImage = GameObject.Find("LevelImage");

        //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
        //   levelText = GameObject.Find("LevelText").GetComponent<Text>();

        //Set the text of levelText to the string "Day" and append the current level number.
        //  levelText.text = "Day " + level;

        //Set levelImage to active blocking player's view of the game board during setup.
        //     levelImage.SetActive(true);

        //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
        //     Invoke("HideLevelImage", levelStartDelay);

        //Clear any Enemy objects in our List to prepare for next level.
        //   enemies.Clear();

        //Call the SetupScene function of the BoardManager script, pass it current level number.
        boardScript.SetupScene(level);
    }
示例#6
0
    //Initializes the game for each level.
    void InitGame()
    {
        //While doingSetup is true the player can't move, prevent player from moving while title card is up.
        doingSetup = true;

        //Get a reference to our image LevelImage by finding it by name.
        levelImage = GameObject.Find("LevelImage");

        //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
        levelText = GameObject.Find("LevelText").GetComponent <Text>();

        //Set the text of levelText to the string "Day" and append the current level number.
        levelText.text = "Floor " + level;

        //Set levelImage to active blocking player's view of the game board during setup.
        levelImage.SetActive(true);

        //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
        Invoke("HideLevelImage", levelStartDelay);

        //Call the SetupScene function of the BoardManager script, pass it current level number.
        boardScript.SetupScene(level);
    }
示例#7
0
    //Initializes the game for each level.
    void InitGame()
    {
        //While doingSetup is true the player can't move, prevent player from moving while title card is up.
        doingSetup = true;

        //Get a reference to our image LevelImage by finding it by name.
        levelImage = GameObject.Find("LevelImage");

        //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
        levelText = GameObject.Find("LevelText").GetComponent <Text>();

        //Set the text of levelText to the string "Day" and append the current level number.
        levelText.text = "Day " + level;

        //Set levelImage to active blocking player's view of the game board during setup.
        levelImage.SetActive(true);

        //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
        Invoke("HideLevelImage", levelStartDelay);

        //Clear any Enemy objects in our List to prepare for next level.
        enemies.Clear();


        //0:Slushie		1:Squip		2:Green/Red MntDew		3:MntDew/Squip
        if (playerFoodPoints > 200)
        {
            itemSet = 2;
        }
        else
        {
            itemSet = 3;
        }

        //Call the SetupScene function of the BoardManager script, pass it current level number.
        boardScript.SetupScene(level, itemSet);
    }
示例#8
0
    //Initializes the game for each level.
    void InitGame()
    {
        //While doingSetup is true the player can't move, prevent player from moving while title card is up.
        doingSetup = true;

        //Get a reference to our image LevelImage by finding it by name.
        levelImage = GameObject.Find("LevelImage");

        //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
        questText = GameObject.Find("QuestText").GetComponent <Text> ();

        //Get a reference to the inventory canvas.
        slideOutCanvas = GameObject.FindGameObjectWithTag("InventoryCanvas");

        //Get reference to the inventory script.
        inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory> ();

        //Set the text of levelText to the string "Quest" and append the current level number.
        questText.text = "Quest: " + level;

        //Set levelImage to active blocking player's view of the game board during setup.
        levelImage.SetActive(true);

        //Set inventory canvas to active to instantiate the inventory.
        slideOutCanvas.SetActive(true);

        //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
        Invoke("HideLevelImage", levelStartDelay);

        //Clear any Enemy objects in our List to prepare for next level.
        enemies.Clear();

        //Call the SetupScene function of the BoardManager script, pass it current level number.
        boardScript.SetupScene(level);
        // refrence the player in the scene
        _player = FindObjectOfType <Player>();
    }
示例#9
0
    //Initializes the game for each level.
    void InitGame()
    {
        Debug.Log("InitGame");
        //While doingSetup is true the player can't move, prevent player from moving while title card is up.
        doingSetup = true;
        money      = 0;
        karma      = 1.00f;

        //Get a reference to our image LevelImage by finding it by name.
        levelImage = GameObject.Find("LevelImage");

        //Get a reference to our text LevelText's text component by finding it by name and calling GetComponent.
        levelText = GameObject.Find("LevelText").GetComponent <Text>();
        //Set the text of levelText to the string "Day" and append the current level number.
        levelText.text = "Get Ready !!";

        moneyText      = GameObject.Find("MoneyText").GetComponent <Text>();
        moneyText.text = "Money: " + money + "$";

        karmaText      = GameObject.Find("KarmaText").GetComponent <Text>();
        karmaText.text = "Karma: " + karma.ToString("f2") + "%";

        //Set levelImage to active blocking player's view of the game board during setup.
        levelImage.SetActive(true);

        //Call the HideLevelImage function with a delay in seconds of levelStartDelay.
        Invoke("HideLevelImage", levelStartDelay);

        //Clear any Enemy objects in our List to prepare for next level.
        enemies.Clear();
        housings.Clear();

        //Call the SetupScene function of the BoardManager script, pass it current level number.
        boardScript.SetupScene(level);
        fireSpawnerScript.StartFires();
    }
示例#10
0
    public void InitGame()
    {
        doingSetup = true;

        shownLevel = level;


        if (level > PlayerPrefs.GetInt("HighScore"))
        {
            PlayerPrefs.SetInt("HighScore", level);
        }

        firstTime.SetActive(false);
        enemy1.SetActive(false);
        enemy2.SetActive(false);
        enemy3.SetActive(false);
        fire.SetActive(false);
        walls.SetActive(false);

        restartButton = GameObject.Find("RestartButton");
        exitButton    = GameObject.Find("ExitButton");
        levelImage    = GameObject.Find("LevelImage");
        levelText     = GameObject.Find("LevelText").GetComponent <Text>();
        highScore     = GameObject.Find("HighScore");

        highScore.SetActive(false);
        restartButton.SetActive(false);
        exitButton.SetActive(false);
        levelText.text = "level " + level;
        levelImage.SetActive(true);
        Invoke("HideLevelImage", levelStartDelay);

        enemies.Clear();
        fires.Clear();
        boardScript.SetupScene(level);
    }
示例#11
0
 void InitGame()
 {
     doingSetup = true;
     boardScript.SetupScene();
 }
示例#12
0
 //Initializes the game for each level.
 void InitGame()
 {
     //Call the SetupScene function of the BoardManager script, pass it current level number.
     boardScript.SetupScene(level);
 }
示例#13
0
 void InitGame()
 {
     BoardManager.SetupScene(level);
 }
示例#14
0
 void InitGame()
 {
     boardScript.SetupScene(1);
 }
示例#15
0
 void InitGame()
 {
     boardScript.SetupScene(level);
 }
示例#16
0
 public void InitGame()
 {
     boardManagerScript.SetupScene(level);
 }
示例#17
0
 void initGame()
 {
     boardScript.SetupScene(lvl);
 }
示例#18
0
 //Initializes the game for each level.
 void InitGame()
 {
     enemies.Clear();
     //ボードスクリプトを呼び出す。
     boardScript.SetupScene(level);
 }
示例#19
0
 void InitGame()
 {
     BoardScript.SetupScene(Level);
 }
示例#20
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     _BoardManager = (BoardManager)GetTree().GetNodesInGroup("BoardManager")[0]; //como el script esta en el nodo lo busco de esta manera
     _BoardManager.SetupScene(1);
 }
示例#21
0
 public void InitGame()
 {
     boardScript.SetupScene(level, wordGen, board, theme, this);
 }
示例#22
0
 void InitGame()
 {
     enemies.Clear();
     boardScript.SetupScene(level);
 }
示例#23
0
 void InitGame()
 {
     //RegisterFactories();
     boardScript.SetupScene(level);
 }
示例#24
0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;

public class GameManager : MonoBehaviour {

    public float levelStartDelay = 2f; 
    public float turnDelay = .1f;
    public static GameManager instance = null;
    public BoardManager boardScript;
    public int playerFoodPoints = 100;

    [HideInInspector] public bool playersTurn = true;

    private Text levelText;
    private GameObject levelImage;
    private int level = 1;
    private List<Enemy> enemies;
    private bool enemiesMoving;
    private bool doingSetup;

        // Use this for initialization
    void Awake () {
	        if(instance == null)
		    	instance=this;
	        else if( instance != this)
		    	Destroy(gameObject);
	        DontDestroyOnLoad(gameObject);
	        enemies = new List<Enemy> ();
	        boardScript = GetComponent<BoardManager>();
	        InitGame();
	    }
    
    private void OnLevelWasLoaded(int index){
	        level++;

	        InitGame ();
	    }

    void InitGame(){
	        doingSetup = true;

	        levelImage = GameObject.Find ("LevelImage");
	        levelText = GameObject.Find ("LevelText").GetComponent<Text> ();
	        levelText.text = "Day" + level;
	        levelImage.SetActive (true);
	        Invoke ("HideLevelImage", levelStartDelay);

	        enemies.Clear ();
	        boardScript.SetupScene(level);
	    }

    private void HideLevelImage(){
	        levelImage.SetActive (false);
	        doingSetup = false;
	    }

    public void GameOver(){
		levelText.text = "After " + level + " days, you starved.";
		levelImage.SetActive (true);
	        enabled = false;
	    }
    // Update is called once per frame
    void Update () {
	        if (playersTurn || enemiesMoving || doingSetup)
		                return;
	        StartCoroutine (MoveEnemies ());
	    }

    IEnumerator MoveEnemies(){
	        enemiesMoving = true;
	        yield return new WaitForSeconds (turnDelay);
	        if (enemies.Count == 0) {
		                yield return new WaitForSeconds (turnDelay);
		            }
	        for (int i = 0; i < enemies.Count; i++) {
		                enemies [i].MoveEnemy ();
		                yield return new WaitForSeconds (enemies [i].moveTime);
		            }
	        playersTurn = true;
	        enemiesMoving = false;
	    }

    public void AddEnemyToList(Enemy script){
	        enemies.Add (script);
	    }
}



示例#25
0
 void InitGame()
 {
     NotificationSystem.start();
     boardScript.SetupScene(level);
 }
示例#26
0
 /// <summary>
 /// Initialize BoardManager and game components
 /// </summary>
 private void InitGame()
 {
     BoardScript.SetupScene(level);
 }
示例#27
0
 void InitGame()                    //Starts the game.
 {
     enemies.Clear();               //Clears enemy list
     boardScript.SetupScene(level); //Call the SetupScene function of the BoardManager script.
 }
示例#28
0
 public void InitGame()
 {
     boardScript.SetupScene();
 }
示例#29
0
 public void LevelChange(int levelSelectIndex)
 {
     boardScript.SetupScene(levelSelectIndex + 1);
 }
 //Initializes the map.
 void InitGame()
 {
     //Call the SetupScene function of the BoardManager script
     boardScript.SetupScene();
 }
示例#31
0
 private void InitGame()
 {
     boardManager.SetupScene(gameData.level);
 }