Example #1
0
 // constructor
 public GameLogic()
 {
     _board = new Board();
     // listen to board changes
     _board.AddListener(new Board.EventListener(() => {
         UpdateBoard();
         // disable hints when board is updated
         _drawHints = false;
     }));
 }
Example #2
0
        private GameObject _visibleSphere; // the inner, visible sphere

        #endregion Fields

        #region Methods

        // constructor
        public void Init(int id, Board board, Camera globalCamera)
        {
            _id = id;
            _board = board;
            _camera = globalCamera;
            _balls.Add(_id, this);
            // ensure correct position and scale
            _visibleSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            _visibleSphere.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
            _visibleSphere.transform.SetParent(transform);
            // the selectable sphere is bigger
            transform.position = new Vector3(_id%7 - 3, 0, _id/7 - 3);
            GetComponent<Renderer>().material = Materials.InvisibleMaterial;
            // update the state
            Update();
        }