Example #1
0
 private void OnMouseEnter(MouseEnterEvent MouseEnterEvent)
 {
     if (!IsSelected.GetValue())
     {
         style.backgroundColor = Color.gray;
     }
 }
Example #2
0
 public override void OnAfterTransition()
 {
     if (GameState.GetValue() == false)
     {
         ToGameEndState();
     }
 }
 private void Update()
 {
     if (hasShownInitialScene.GetValue() && _gaveItems && !_isRecievingItem)
     {
         _itemController.SpeechBubbleDistanceCheck();
     }
 }
Example #4
0
 // Update is called once per frame
 void Update()
 {
     if (AlwaysUpdate)
     {
         Toggle.onValueChanged.RemoveAllListeners();
         Toggle.isOn = Toggled.GetValue() ^ ShouldInvert;
         Toggle.onValueChanged.AddListener(ToggleClicked);
     }
 }
Example #5
0
    //verifies if player can move and if it's not clicking on UI
    private bool CanMovePlayer()
    {
        if (Input.touchCount > 0)
        {
            _pointerID = Input.GetTouch(0).fingerId;
        }

        return(Input.GetButtonDown("Fire1") && canPlayerMove.GetValue() && !EventSystem.current.IsPointerOverGameObject(_pointerID));
    }
Example #6
0
 public void ToNextState()
 {
     if (GameState.GetValue() == false)
     {
         stateMachine.ChangeState <GameEndState>();
     }
     else
     {
         stateMachine.ChangeState <SettleState>();
     }
 }
Example #7
0
 public void FormGroup(GroupData data)
 {
     if (DebugBlockGrouping.GetValue() == true)
     {
         Debug.Log(data.width * data.height);
     }
     if (data.width * data.height >= 4)
     {
         Group group = groupSpawner.GetGroup();
         group.Setup(data);
         activeGroups.Add(group);
     }
 }
Example #8
0
    private bool IsGhostAndWantsThisItem(Collider2D collider)
    {
        if (canPlayerInteract.GetValue())
        {
            var itemController = collider.GetComponentInChildren <ItemTradeController>(true);

            if (itemController != null)
            {
                return(itemController.RecievedItem(_item, gameObject));
            }
        }

        return(false);
    }
Example #9
0
 public void ToNextState()
 {
     if (GameState.GetValue() == false)
     {
         stateMachine.ChangeState <GameEndState>();
     }
     else if (activeBlocks.Count > 0)
     {
         stateMachine.ChangeState <FallState>();
     }
     else
     {
         stateMachine.ChangeState <ControlState>();
     }
 }
Example #10
0
        public void CheckRect()
        {
            Block         block;
            BlockPosition pos;

            GroupData data;

            //Check all active regular blocks to see whether or not they are grouped
            for (int i = 0; i < activeBlocks.Count; i++)
            {
                block = activeBlocks.Items[i];

                if (block.data.type.Equals(BlockType.breaker) || block.data.type.Equals(BlockType.diamond))
                {
                    continue;
                }

                pos = board.BlockPos(block);

                Block current;

                //Find a corner then calculate the area of the group
                switch (pos)
                {
                case BlockPosition.topLeft:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Top Left", block);
                    }

                    data = CalcArea(block, Direction.down, Direction.right);
                    FormGroup(data);
                    break;

                case BlockPosition.top:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Top", block);
                    }

                    //Get block on far left, check down
                    current = GetEndBlock(block, Direction.left, Direction.down);

                    data = CalcArea(current, Direction.down, Direction.right);
                    FormGroup(data);

                    break;

                case BlockPosition.topRight:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Top Right", block);
                    }

                    data = CalcArea(block, Direction.down, Direction.left);
                    FormGroup(data);

                    break;

                case BlockPosition.left:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Left", block);
                    }

                    //Get block on far down
                    current = GetEndBlock(block, Direction.down, Direction.right);

                    data = CalcArea(current, Direction.up, Direction.right);
                    FormGroup(data);

                    break;

                case BlockPosition.middle:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Middle", block);
                    }

                    //Get bottom left corner block

                    //Get block on far left, check down
                    current = GetEndBlock(block, Direction.left, Direction.down);

                    //Get block on far down, check right
                    current = GetEndBlock(current, Direction.down, Direction.right);

                    //Calculate area
                    data = CalcArea(current, Direction.up, Direction.right);
                    FormGroup(data);

                    break;

                case BlockPosition.right:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Right", block);
                    }

                    //Get block on far up, check left
                    current = GetEndBlock(block, Direction.up, Direction.left);


                    data = CalcArea(current, Direction.down, Direction.left);
                    FormGroup(data);

                    break;

                case BlockPosition.bottomLeft:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Bottom Left", block);
                    }

                    data = CalcArea(block, Direction.up, Direction.right);
                    FormGroup(data);

                    break;

                case BlockPosition.bottom:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Bottom", block);
                    }

                    //Get block on far right, check up
                    current = GetEndBlock(block, Direction.right, Direction.up);


                    data = CalcArea(current, Direction.up, Direction.left);
                    FormGroup(data);

                    break;

                case BlockPosition.bottomRight:
                    if (DebugBlockPosition.GetValue() == true)
                    {
                        Debug.Log("Bottom Right", block);
                    }

                    data = CalcArea(block, Direction.up, Direction.left);
                    FormGroup(data);

                    break;

                default:

                    break;
                }
            }
        }