Example #1
0
 private void Awake()
 {
     Instance        = this;
     cameraContainer = Camera.main.transform;
     currentSpawnZ   = 0;
     currentLevel    = 0;
 }
Example #2
0
    void Start()
    {
        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            // startMenuPos = GameObject.Find("StartMenu").transform.position - new Vector3(0, 0, 10);
            chaptSelPos     = GameObject.Find("ChapterMenu").transform.position - new Vector3(0, 0, 10);
            levSelPos       = GameObject.Find("LevelMenu").transform.position - new Vector3(0, 0, 10);
            settingsMenuPos = GameObject.Find("SettingsMenu").transform.position - new Vector3(0, 0, 10);

            levelManager levMan = GameObject.Find("LevelManager").GetComponent <levelManager>();

            if (levMan.ChapterLoaded)
            {
                levMan.setupLevelButtons();
                transform.position = levSelPos + new Vector3(8, 0, 0);
                desiredPos         = levSelPos;
            }
            else
            {
                //transform.position = startMenuPos;
                desiredPos = transform.position;
            }
        }
        else if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            desiredPos = new Vector3(0, 0, -10);
        }
        else
        {
            desiredPos = transform.position;
        }
    }
Example #3
0
 void Start()
 {
     myRigidBody    = GetComponent <Rigidbody2D>();                                  //získání komponentu z Rigidbody2d
     myAnim         = GetComponent <Animator>();                                     //ziskani komponentu z Animatoru
     respawnPoint   = transform.position;                                            //ulozeni zakladni respawn pozice
     myLevelManager = FindObjectOfType <levelManager>();                             //ziskani objektu typu levelManager
 }
 // Start is called before the first frame update
 void Start()
 {
     theLevelMan = Object.FindObjectOfType <levelManager>();
     if (startTimes[startTimes.Length - 1] + totalSpawningTime >= theLevelMan.lastSpawnTime)
     {
         theLevelMan.lastSpawnTime = startTimes[startTimes.Length - 1] + totalSpawningTime;
     }
 }
Example #5
0
 // Update is called once per frame
 void Update()
 {
     if (playerCount >= 2)
     {
         levelManager lev = GameObject.FindGameObjectWithTag("GameController").GetComponent <levelManager>();
         lev.loadScene(nextLevelName);
     }
 }
Example #6
0
    void Start()
    {
        levelscript = GameObject.Find("Level Manager").GetComponent <levelManager>();

        targetPos = transform.position;
        seed      = Random.Range(0, 1.0f);
        speed     = Random.Range(0.5f, 0.8f);
        //randomize size
    }
	void Awake(){
		instance = this;
		scoreValue = 0;
		starsValue = 0;
		lifesValue = 5;
		enemiesInterval = 0.7f;
		enemiesInstanced = false;
		enemiesSpeed = 0.1f;

	}
 void Awake()
 {
     instance         = this;
     scoreValue       = 0;
     starsValue       = 0;
     lifesValue       = 5;
     enemiesInterval  = 0.7f;
     enemiesInstanced = false;
     enemiesSpeed     = 0.1f;
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     isBreakble = (this.tag == "Breakable");
     if (isBreakble)
     {
         breakableCount++;
     }
     timesHit     = 0;
     levelManager = GameObject.FindObjectOfType <levelManager>();
 }
Example #10
0
    public static void saveLevelInfo(levelManager levelman)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/info.nfo";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        gameData data = new gameData(levelman);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Example #11
0
    // Use this for initialization
    void Start()
    {
        //Get player and Information
        player          = GameObject.Find("Player");
        playerTransform = player.GetComponent <Transform>();

        //Get LevelManager and Information
        lvlManager   = GameObject.Find("lvlMan");
        levelManager = lvlManager.GetComponent <levelManager>();

        testing = true;
    }
Example #12
0
 public static levelManager GetInstance(object key)   // unique key for your stage
 {
     lock (_instances) {
         levelManager instance;
         if (!_instances.TryGetValue(key, out instance))
         {
             instance = new levelManager();
             _instances.Add(key, instance);
         }
         return(instance);
     }
 }
Example #13
0
    private void Start()
    {
        scm      = GameObject.FindWithTag("GameController").GetComponent <SCM>();
        LS       = GameObject.FindWithTag("GameController").GetComponent <lifeSystem>();
        lManager = GameObject.FindWithTag("levelManager").GetComponent <levelManager>();

        if (lManager.level2)
        {
            cPanel  = GameObject.FindWithTag("jerigenMinyak").GetComponent <controlPanel>();
            cPanel2 = GameObject.FindWithTag("pipa").GetComponent <controlPanel>();
        }
    }
Example #14
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this);
 }
Example #15
0
    private void Update()
    {
        gasFill.fillAmount = gas / 100;

        if (gas >= 100)
        {
            gas          = 100;
            full         = true;
            lManager     = GameObject.FindGameObjectWithTag("levelManager").GetComponent <levelManager>();
            lManager.end = true;
            fullSound.SetActive(true);
        }
    }
Example #16
0
 // Use this for initialization
 void Start()
 {
     target            = GameObject.FindWithTag("MainCamera").transform;
     charc             = GameObject.FindWithTag("MainCamera").GetComponent <shooting> ();
     manager           = GameObject.Find("GameControl").GetComponent <levelManager>();
     maxLookDis        = 25f;
     maxAttackDis      = 25f;
     minDistFromPlayer = 0f;
     rotationDamping   = 2f;
     interval          = 2f;
     shotTime          = 0f;
     positionY         = transform.position.y;
     //ani = gameObject.GetComponent<Animator> ();
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     myLvlManager = GetComponent <levelManager> ();
     if (myLvlManager.IsLvlMainMenu())
     {
         policeLang = policeSubs.GetComponent <setLanguage> ();
         policeText = policeSubs.GetComponent <Text> ();
     }
     timeToSkip = 3.0f;
     skipTimer  = 0.0f;
     SetCanvases();
     GetPauseMenu();
     textList = new List <Text> (FindObjectsOfType <Text>());
 }
Example #18
0
 /**
  * initialize variables and set the level
  */
 void Start()
 {
     height  = new Vector3(0, 0.93f, 0);
     buttons = new GameObject[7] {
         button1, button2, button3, button4, button5, button6, button7
     };
     blockId = 0;
     blocks  = new List <GameObject>();
     addBlock(startButton);
     lm = levelManager.GetComponent <levelManager>();
     lm.setLevel(activeLevel.GetComponent <activeLevel>().getLevel());
     GetComponent <AudioSource>().volume = activeLevel.GetComponent <activeLevel>().getMusicVol();
     lm.setVol(activeLevel.GetComponent <activeLevel>().getSfxVol());
 }
Example #19
0
    // Use this for initialization
    void Start()
    {
        //  this script is necessary because the object that the buttons need to connect with is not from their actual scene
        //  (and therefore cannot be connected in editor)

        LM       = GameObject.FindGameObjectWithTag("GameController").GetComponent <levelManager>();
        myButton = this.gameObject.GetComponent <UnityEngine.UI.Button>();

        //DELEGATES <3 <3 <3

        myButton.onClick.AddListener(delegate {
            LM.exitLevel();
        });
    }
Example #20
0
    // Use this for initialization
    void Start()
    {
        //  this script is necessary because the object that the buttons need to connect with is not from their actual scene
        //  (and therefore cannot be connected in editor)

        LM       = GameObject.FindGameObjectWithTag("LevelManager").GetComponent <levelManager> ();
        myButton = this.gameObject.GetComponent <Button> ();

        //my first time using delegates  <3 <3

        myButton.onClick.AddListener(delegate {
            LM.loadLevelByID(level);
        });
    }
Example #21
0
    }                                 // aktif olan levelden sonraki levelin indexi

    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        currentLevel = Convert.ToInt16(SceneManager.GetActiveScene().buildIndex);
        endLevel     = Convert.ToInt16(SceneManager.GetActiveScene().buildIndex) + 1;
    }
Example #22
0
    // Use this for initialization
    void Start()
    {
        winScreen   = GameObject.Find("WinScreen");                                                 //Get win screen GO so its contents can be modified when player wins
        soundPlayer = GetComponent <AudioSource>();                                                 //Get audio source component so can play sound effects

        tiles = new List <GameObject>();                                                            //Initialize tiles list

        swipeDir = SwipeDirection.none;                                                             //Set swipe direction to defaul

        levManager   = GameObject.Find("LevelManager").GetComponent <levelManager>();               //Get level manager from level manager gameobject in scene
        currentLevel = levManager.CurrentLevel;                                                     //Get current level from level manager, will reference this for building board

        worldScreenWidth = Camera.main.orthographicSize * 2f * Screen.width / Screen.height;        //Get width of screen in world units
                                                                                                    //(orthographic size of cam is 1/2 of screen height, so multiply by 2 and then the ratio of width/height to get width)

        localScreenWidth = worldScreenWidth / gridBG.GetComponent <SpriteRenderer>().bounds.size.x; //Get local width of screen by dividing world width by width of background sprite

        buildGrid();                                                                                //Sets up grid with appropriate spaces reflecting current level's width and height, then calls LoadTiles function to load in tiles

        gameState = GameState.playing;                                                              //Default state to playing
    }
Example #23
0
    // Use this for initialization
    void Start()
    {
        //Get player and Information
        player          = GameObject.Find("Player");
        playerTransform = player.GetComponent <Transform>();

        //Get LevelManager and Information
        lvlManager   = GameObject.Find("lvlMan");
        levelManager = lvlManager.GetComponent <levelManager>();
        //checkPointRadius = levelManager.checkPointRadius;
        //print(checkPointRadius);

        bullets = new List <GameObject>();        //instantiating the list
        firing  = false;

        for (int i = 0; i < pooledAmount; i++)
        {
            GameObject obj = (GameObject)Instantiate(bullet); //creating a bullet for the pool
            obj.SetActive(false);                             //setting the bullet as inactive
            bullets.Add(obj);                                 //adding it to the bullet pool
        }
    }
    // Use this for initialization
    void Start()
    {
        levelMan = GameObject.Find ("persistentGM").GetComponent<levelManager> ();

        //GameObject.DontDestroyOnLoad (gameObject);
    }
Example #25
0
 // Use this for initialization
 void Start()
 {
     myLevelManager = FindObjectOfType <levelManager> ();
 }
    // Use this for initialization
    void Start()
    {
        character = GameObject.Find("Character");
        if(manager == null) manager = GameObject.Find("LevelManager").GetComponent<levelManager>();

        if(manager.getStory() && !manager.getStoryDone())
        {
            // place oak on map.
            oak = Instantiate(Resources.Load("_Prefabs/Oak")) as GameObject;
            Vector2 pos = new Vector2(5,-11);
            oak.transform.position = pos;
            oak.GetComponent<OakScript>().face(0);

            gary = GameObject.Find("Gary");

            sheet = Resources.LoadAll<Sprite>("_Sprites/PokeLetters");
        }
    }
Example #27
0
 // Use this for initialization
 void Start()
 {
     result = GameObject.Find("GameControl").GetComponent <levelManager>();
 }
Example #28
0
 // Use this for initialization
 void Start()
 {
     levelManager = FindObjectOfType <levelManager>();
     StartGame();
     ShowGuess();
 }
Example #29
0
 // Use this for initialization
 void Start()
 {
     levelMan = GameObject.Find ("persistentGM").GetComponent<levelManager> ();
     vineUI = levelMan.gameObject.transform.GetChild (0).GetChild (1).gameObject;
     fadeImage = levelMan.gameObject.transform.GetChild (0).GetChild (2).GetChild (0).gameObject.GetComponent<Image> ();
     persAud = GameObject.Find ("persistentAudioGM").GetComponent<persistentAudio> ();
 }
Example #30
0
 public gameData(levelManager levelman)
 {
     totalCoins = levelman.coinsValue;
 }
Example #31
0
    // Use this for initialization
    void Start()
    {
        gmEventSystem = persInv.transform.GetChild (1).gameObject;
        if (PlayerPrefs.GetInt ("SaveLevel") != 0) {
            savedGame = true;
            savedLevel = PlayerPrefs.GetInt("SaveLevel");

        } else {
            savedGame = false;
        }
        persAud = GameObject.Find ("persistentAudioGM").GetComponent<persistentAudio> ();
        persInv = GameObject.Find ("persistentGM");
        levelMan = persInv.GetComponent<levelManager> ();
    }
Example #32
0
 // Use this for initialization
 void Start()
 {
     interval = 0.5f;
     manager  = GameObject.Find("GameControl").GetComponent <levelManager>();
 }
Example #33
0
 private void Start()
 {
     LManager = GameObject.Find("level Manager").GetComponent <levelManager>();
 }
Example #34
0
 void Start()
 {
     levelMan = this;
     Application.targetFrameRate = 60;
 }
Example #35
0
	// Use this for initialization
	void Awake () {

		level = GetComponent<levelManager>();
		timeText.text="";

	}
Example #36
0
 // Use this for initialization
 void Start()
 {
     levelMan = GameObject.Find ("persistentGM").GetComponent<levelManager> ();
 }
Example #37
0
 private void Awake()
 {
     instance       = this;
     lifeText.text  = "Lives: " + hitpoint.ToString();
     scoreText.text = "Current Score: " + score.ToString();
 }