Exemple #1
0
        protected override void Awake()
        {
            base.Awake();

            Instance = this;

            var terrain = new TerrainComponent();

            Components.Add(terrain);

            terrain.Initialise();
        }
        // Use this for initialization
        void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else if (Instance != this)
            {
                Destroy(gameObject);
                enabled = false;
                gameObject.SetActive(false);
                return;
            }

            enemies = new List<Enemy>();
            BoardManager = FindObjectOfType<BoardManager>();
            DontDestroyOnLoad(gameObject);
        }
Exemple #3
0
        public void InitBoard(GameManager gManager, int width, int height)
        {
            _gameManager = gManager;

            ClearBoard();

            transform.position = new Vector3(0f, 0f, 0);

            BoardHeight = height;
            BoardWidth = width;
            Gems = new List<GemLogic>(height*width);

            for (var i = 0; i < BoardWidth; i++){
                for (var j = 0; j < BoardHeight; j++){
                    AddGem(i, j);
                }
            }
        }