Esempio n. 1
0
        public static bool TryToChangeState(Beans player)
        {
            // 移動可能な畑を目指す
            var farms = Field.FieldManager.AllFarms()
                        .Where(x => player.IsReachable(x.transform.position))
                        .ToArray();

            if (farms.Any())
            {
                var targetCell = farms[UnityEngine.Random.Range(0, farms.Length)];
                StateToCell.ChangeState(player, targetCell);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public void OnReceiveSignal(Signal signal, GameObject gameObject)
        {
            switch (signal)
            {
            case Signal.ToFarm:
                Debug.Assert(player.hasWaterBall());
                StateToCell.ChangeState(player, gameObject);
                return;

            case Signal.ToObstacle:
                StateToObstacle.ChangeState(player, gameObject);
                return;

            case Signal.ToWaterBall:
                StateToWaterBall.ChangeState(player, gameObject);
                return;

            default:
                throw new NotImplementedException();
            }
        }