Ejemplo n.º 1
0
    void Start()
    {
        playSessionManager = GameObject.Find("PlaySessionManager").GetComponent <PlaySessionManager> ();

        armor  = armorStart;
        hp     = hpStart;
        target = Path.points [pathIndex];
    }
Ejemplo n.º 2
0
    void Start()
    {
        playSessionManager = GameObject.Find("PlaySessionManager").GetComponent <PlaySessionManager> ();

        textPrice.text = tower.priceBuy.ToString();

        // при изменении
        playSessionManager.OnMoneyChange += UpdateAccessibility;
    }
Ejemplo n.º 3
0
 void Start()
 {
     playSessionManager = GameObject.Find("PlaySessionManager").GetComponent <PlaySessionManager> ();
     // поиск ближайшего врага каждые 0,5 секунды
     InvokeRepeating("UpdateTarget", 0f, 0.5f);
     // скрыть GUI башни
     UIselected.SetActive(false);
     // редактирование размерв GUI дальности стрельбы
     UIfireRange.transform.localScale = new Vector3(range, range, 0f);
 }
 private void Awake()
 {
     if (ins == null)
     {
         ins = this;
     }
     else if (ins != this)
     {
         Destroy(gameObject);
         return;
     }
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         SceneManager.sceneLoaded += OnSceneLoad;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 6
0
    void Start()
    {
        playSessionManager = GameObject.Find("PlaySessionManager").GetComponent <PlaySessionManager> ();

        spawnPoint = GameObject.Find("WayPointStart");

        waves           = new SubWave[10, 10];
        waves           = DataTransfer.levelsWavesList[DataTransfer.chosenLevel];
        subWaveIndexMax = DataTransfer.subWavesAmount;
        waveIndexMax    = DataTransfer.wavesAmount;

        // Спавн всех волн
        StartCoroutine(SpawnWaves());
    }
 // Singleton Pattern, OnSceneLoad Method Added
 private void Awake()
 {
     if (ins == null)
     {
         ins = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (ins != this)
     {
         Destroy(gameObject);
         return;
     }
     SceneManager.sceneLoaded += OnSceneLoad;
 }
 void Awake()        // Runs when script is loaded, before game runs
 {
     // Singleton Pattern to have a single instance of the PlaySession manager
     if (ins == null)                   //Checks whether there is already an Instance,
     {
         ins = this;                    //If there is no instance sets itself to be the instance
         DontDestroyOnLoad(gameObject); //Makes it so the object will persist through scenes
     }
     else if (ins != this)              //if the instance is set to something other than this object
     {
         Destroy(gameObject);           //destroy this object as there is already a different instance
         return;                        // returns to prevent running any more code in this method
         // as it can take a short time for the object to be destroyed
     }
 }
Ejemplo n.º 9
0
    void Awake()
    {
        //Singleton pattern
        if (ins == null)
        {
            ins = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (ins != this)
        {
            Destroy(gameObject);
            return;
        }
        //Get player data
        data          = SaveManager.LoadGameData();
        furthestLevel = data.furthestLevel;

        //Subscribe to level events
        SceneManager.sceneLoaded += OnSceneLoad;
        LevelManager.OnLevelEnd  += HandleLevelEnd;
    }
Ejemplo n.º 10
0
    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
            DontDestroyOnLoad(this);
        }

        audioManager       = FindObjectOfType <AudioManager>();
        levelManager       = FindObjectOfType <LevelManager>();
        playSessionManager = FindObjectOfType <PlaySessionManager>();
        uiManager          = FindObjectOfType <UIManager>();
        playerManager      = FindObjectOfType <PlayerManager>();
        eventSystem        = FindObjectOfType <EventSystem>();
        mainCamera         = FindObjectOfType <Camera>();
        poolManager        = FindObjectOfType <PoolManager>();
        enemyManager       = FindObjectOfType <EnemyManager>();
        cameraControl      = FindObjectOfType <CameraControl>();
    }