Exemplo n.º 1
0
        // ----------------------
        // Data Assignment
        // ----------------------
        #region Assigning Data to Cell
        public void OnPointerClick(PointerEventData eventData)
        {
            // Do nothing if user didn't click with the left mouse button
            if (eventData.button != PointerEventData.InputButton.Left)
            {
                return;
            }

            if (LevelEditor.instance.HasBuildingBlockSelected())
            {
                LevelEditor.instance.AddToActionStack(this);
                BuildingBlock currentlySelected = LevelEditor.instance.GetCurrentBuildingBlock();
                AssignBuildingBlock(currentlySelected, false);
            }
        }
Exemplo n.º 2
0
 // -----------------------
 // Building Block Selection
 // -----------------------
 #region BUILDING BLOCK SELECTION
 public void SelectBuildingBlock(BuildingBlock _selected)
 {
     m_currentlySelectedBuildingBlock = _selected;
     currentlySelectedBuildingBlock.AssignBuildingBlock(_selected, true);
     currentlySelectedBuildingBlock.UpdateUI();
 }
Exemplo n.º 3
0
        // [TO DO]
        // parameter bool _isFeedback possibly indicates that function has two different behaviors
        // fix that (don't have bool parameters)
        public void AssignBuildingBlock(BuildingBlock _block, bool _isFeedback)
        {
            switch (_block.buildingBlockType)
            {
            case BuildingBlock.EBuildingBlockType.Number:
                cellType   = ECellType.Number;
                cellStatus = ECellStatus.Visible;

                NumberBlock block = (NumberBlock)_block;
                m_textReference.text = block.numberValue.ToString();
                intCellContent       = block.numberValue;
                m_currentColor       = LevelEditor.instance.colorConfiguration.numberBlockColor;
                break;

            case BuildingBlock.EBuildingBlockType.Operation:
                cellType   = ECellType.Operation;
                cellStatus = ECellStatus.Visible;

                OperationBlock opBlock = (OperationBlock)_block;
                m_textReference.text = opBlock.operationCharacter.ToString();
                charCellContent      = opBlock.operationCharacter;
                m_currentColor       = LevelEditor.instance.colorConfiguration.operationBlockColor;
                break;

            case BuildingBlock.EBuildingBlockType.Hide:

                if (cellStatus == ECellStatus.Hidden)
                {
                    cellStatus = ECellStatus.Visible;

                    // current color is now previous color
                    // and previous color is now current color
                    Color tempColor = m_currentColor;
                    m_currentColor  = m_previousColor;
                    m_previousColor = tempColor;
                }
                else if (cellStatus == ECellStatus.Visible)
                {
                    cellStatus = ECellStatus.Hidden;

                    m_previousColor = m_currentColor;
                    m_currentColor  = LevelEditor.instance.colorConfiguration.hiddenBlockColor;
                }


                // just overriding what happened and making the cell blue if it's the feedback cell
                if (_isFeedback)
                {
                    m_currentColor       = LevelEditor.instance.colorConfiguration.hiddenBlockColor;
                    m_textReference.text = "";
                    cellStatus           = ECellStatus.Hidden;
                    cellType             = ECellType.None;
                }
                break;

            case BuildingBlock.EBuildingBlockType.Unused:
                cellType   = ECellType.Unused;
                cellStatus = ECellStatus.Unused;

                m_textReference.text = "";
                m_currentColor       = LevelEditor.instance.colorConfiguration.unusedBlockColor;
                break;
            }

            m_imageReference.color = m_currentColor;
        }