Beispiel #1
0
 public void HealRollCard(GameBoardPlayer player, Card card)
 {
     player.GetGameBoardManager().DiceShooter.Shoot(x =>
     {
         int sum = x.Select(a =>
         {
             if (a.Value == null)
             {
                 return(int.Parse(a.Key.ApproximateValue()));
             }
             else
             {
                 return(int.Parse(a.Value));
             }
         }).Sum();
         Debug.Log("Healing by " + sum);
         player.Health = Mathf.Min(100, player.Health + sum);
         foreach (var item in x.Keys)
         {
             Destroy(item.gameObject);
         }
     }, Resources.Load <Dice>("Dice/Dice4"),
                                                    Resources.Load <Dice>("Dice/Dice6"),
                                                    Resources.Load <Dice>("Dice/Dice8"),
                                                    Resources.Load <Dice>("Dice/Dice4"),
                                                    Resources.Load <Dice>("Dice/Dice4")
                                                    );
 }
        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);
            }
        }
        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();
            }
        }
Beispiel #4
0
 public void PointsPerTurnOnMat(GameBoardPlayer player, Card card)
 {
     Debug.Log("Testing here");
     if (player.PlayMat.Piles.Any(x => x.Value.Cards.Count > 0 && x.Value.Cards.Peek() == card))
     {
         player.Score += 10f;
     }
 }
        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);
            }
        }
Beispiel #6
0
 private void Refresh(GameBoardPlayer player)
 {
     targetPlayer = player;
 }