// FINISHED public void CreateNewObjectIn(BoardPosition Position, int level) { if (GamePaused) { return; } Assert.IsTrue(level >= 1 && level <= ObjectMaterialsByLevel.Length, "Level is correct: " + level); // Create object and its connections BoardObject BoardObject = GameObject.Instantiate <GameObject>(BoardObjectPrefab).GetComponent <BoardObject>(); BoardObject.BoardManager = this; BoardObject.CurrentPosition = Position; // Give it its material BoardObject.GetComponentInChildren <Renderer>().material = ObjectMaterialsByLevel[level - 1]; // Give it its level value BoardObject.SetLevel(level); // Register the object with its position Position.SetObject(BoardObject); // Increment points by an appropriate amount UIManager.IncrementPointsBy(level); }
// FINISHED public void IncreaseLevelOfExistingObject(BoardObject obj) { if (GamePaused) { return; } obj.SetLevel(obj.GetLevel() + 1); obj.GetComponentInChildren <Renderer>().material = ObjectMaterialsByLevel[obj.GetLevel() - 1]; }