Ejemplo n.º 1
0
        public void Choose(GameBoardEntityDirection direction)
        {
            if (movingSum > 0)
            {
                GameBoardManager manager = GetComponentInParent <GameBoardManager>();
                GameBoardPlayer  player  = GetComponentInParent <GameBoardPlayer>();
                movingSum = manager.TryMove(player.GetComponent <GameBoardEntity>(), movingSum, direction);

                if (movingSum <= 0)
                {
                    manager.AmbiguousDirectionSolvedEvent.Invoke();

                    Destroy(this.gameObject);
                }
                else
                {
                    GetComponentInParent <GameBoardManager>()?.AmbiguousDirectionEvent?.Invoke();
                }
            }
            else
            {
                GetComponentInParent <GameBoardManager>()?.AmbiguousDirectionSolvedEvent.Invoke();
                Destroy(this.gameObject);
            }
        }
Ejemplo n.º 2
0
        public void Callback(Dictionary <Dice, string> values)
        {
            int sum = values.Values.Sum(x => System.Convert.ToInt32(x));

            foreach (var item in values.Keys)
            {
                Destroy(item.gameObject);
            }

            GameBoardManager manager = GetComponentInParent <GameBoardManager>();
            GameBoardPlayer  player  = GetComponentInParent <GameBoardPlayer>();

            sum      += player.BaseMovement;
            movingSum = manager.TryMove(player.GetComponent <GameBoardEntity>(), sum);

            if (movingSum <= 0)
            {
                manager.AmbiguousDirectionSolvedEvent.Invoke();

                Destroy(this.gameObject);
            }
            else
            {
                GetComponentInParent <GameBoardManager>()?.AmbiguousDirectionEvent?.Invoke();
            }
        }
Ejemplo n.º 3
0
        public void ElevatorLandEffect(GameBoardEntity entity, Vector3Int coordinates)
        {
            GameBoardPlayer  player    = entity.GetComponent <GameBoardPlayer>();
            GameBoardManager manager   = player.GetGameBoardManager();
            Vector3Int       newCoords = new Vector3Int(coordinates.x, coordinates.y == 0 ? 1 : 0, coordinates.z);

            if (manager.GetTile(newCoords).PathType != GameBoardPathType.BLOCKED)
            {
                player.GetComponent <GameBoardPlayer>().SetCoordinates(newCoords);
            }
        }