Example #1
0
 public void HandleInput(
     Vector2 touchPoint,
     GameOrchestrator orchestrator)
 {
     if (_rateMeDialog.ShouldShowDialog)
     {
         _rateMeDialog.HandleInput(touchPoint);
     }
     else
     {
         if (_playDrawingInfos.HitBox((int)_playTextSize.X, (int)_playTextSize.Y)
             .Contains(touchPoint))
         {
             orchestrator.SetGameState();
         }
         else if (_fartDrawingInfos.HitBox((int)_fartTextSize.X, (int)_fartTextSize.Y)
                  .Contains(touchPoint))
         {
             _soundManager.PlayFart();
         }
         else if (_scoreDrawingInfos.HitBox((int)_scoreTextSize.X, (int)_scoreTextSize.Y)
                  .Contains(touchPoint))
         {
             orchestrator.SetScoreState();
         }
         else if (_aboutDrawingInfos.HitBox((int)_aboutTextSize.X, (int)_aboutTextSize.Y)
                  .Contains(touchPoint))
         {
             orchestrator.SetAboutState();
         }
     }
 }
Example #2
0
 private void TryMovingPhase()
 {
     if (GameOrchestrator.Phase == GameOrchestrator.GamePhase.LearnActions && fedGrass && fedCarrot && fedChicken && fedSelf)
     {
         GameOrchestrator.NextPhase();
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            var console      = new ConsoleStream();
            var orchestrator = new GameOrchestrator(console, console);

            orchestrator.Start();
        }
Example #4
0
        public void HandleInput(GameOrchestrator orchestrator)
        {
            if (_currentTextId < _scoreInfos.Count - 1)
            {
                return;
            }

            orchestrator.SetMenuState();
        }
Example #5
0
 void OnAttacked(float amount)
 {
     Health -= amount;
     if (Health < 0)
     {
         Instantiate(deathEffect, transform.position, Quaternion.identity);
         GameOrchestrator.MrBiscuitsKilled();
         Utility.PhysicalDestroy(gameObject);
     }
 }
Example #6
0
        // This orchestrator initialisation should not be necessary when using an IoC container but for now will do
        private IGameOrchestrator GetNewGameOrchestrator()
        {
            var randomNumberGeneratorService = new RandomNumberGeneratorService();
            var handMovementService          = new HandMovementService(randomNumberGeneratorService);
            var handsPlayFactory             = new HandsPlayFactory(handMovementService);
            var gamePlayerFactory            = new GamePlayerFactory();
            var handsPlayResolverService     = new HandsPlayResolverService();
            var gameOrchestrator             = new GameOrchestrator(gamePlayerFactory, handsPlayFactory, handsPlayResolverService);

            return(gameOrchestrator);
        }
Example #7
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #8
0
 void OnTriggerEnter(Collider col)
 {
     if (col.CompareTag("EscapePoint") && GameObject.FindGameObjectWithTag("MrBiscuits4") != null)
     {
         GameOrchestrator.NextPhase();
         Utility.PhysicalDestroy(gameObject);
     }
     if (col.CompareTag("MrBiscuits4") && !col.transform.parent.GetComponent <SuperBiscuitsController>().isFeeding)
     {
         GameOrchestrator.PlayerKilled();
         Utility.PhysicalDestroy(gameObject);
     }
 }
Example #9
0
 void OnFedItem(InventorySlot.ItemType type)
 {
     timesFed++;
     if (timesFed == 3 && CompareTag("MrBiscuits2"))
     {
         GameOrchestrator.NextPhase();
     }
     if (timesFed >= foodToEvolve)
     {
         GameOrchestrator.NextPhase();
     }
     Health = 1f;
 }
Example #10
0
        public void GivenTwoBots_WhenGameIsPlayed_BotsFinishInExpectedPositions()
        {
            var inputStream      = Substitute.For <IInputStream>();
            var outpuStream      = Substitute.For <IOutputStream>();
            var gameOrchestrator = new GameOrchestrator(inputStream, outpuStream);

            inputStream.ReadLine().Returns("5 5",
                                           "1 2 N",
                                           "LMLMLMLMM",
                                           "3 3 E ",
                                           "MMRMMRMRRM",
                                           "");

            gameOrchestrator.Start();

            outpuStream.Received().WriteLine(Arg.Is <string>("Position x:1 y:3 direction:N"));
            outpuStream.Received().WriteLine(Arg.Is <string>("Position x:5 y:1 direction:E"));
        }
Example #11
0
 void Start()
 {
     messagePanel = GameObject.Find("MessagePanel").GetComponent <RectTransform>();
     goalText     = GameObject.Find("GoalText").GetComponent <Text>();
     _instance    = this;
     if (PlayerPrefs.HasKey("level") && PlayerPrefs.GetInt("level") > 0)
     {
         int level = PlayerPrefs.GetInt("level");
         for (int i = 0; i < level; ++i)
         {
             NextPhase(onlyLog: i < level - 1);
         }
     }
     else
     {
         EnterPhase(GamePhase.LearnActions);
     }
     ScreenFader.FadeIn();
 }
Example #12
0
        public MainMenuPage(
            AssetsLoader assetsLoader,
            GameOrchestrator gameOrchestrator,
            IScreenTransformationMatrixProvider matrixScaleProvider,
            ILocalizedStringsRepository localizedStringsRepository,
            RateMeDialog rateMeDialog,
            ISettingsRepository settingsRepository)
        {
            _backgroundRectangle = new Rectangle(0, 0, matrixScaleProvider.VirtualWidth, matrixScaleProvider.VirtualHeight);

            var titleFont = assetsLoader.TitleFont;

            _writingFont  = assetsLoader.WritingFont;
            _rateMeDialog = rateMeDialog ?? throw new ArgumentNullException(nameof(rateMeDialog));

            const string titleText = "RELLOW";

            _title = new FloatingText(
                titleText,
                new DrawingInfos()
            {
                Position     = new Vector2(matrixScaleProvider.VirtualWidth / 2f, 250f),
                Origin       = titleFont.GetTextCenter(titleText),
                OverlayColor = _foregroundColor
            },
                titleFont);

            var playText = localizedStringsRepository.Get(GameStringsLoader.PlayStringKey);

            _playButton = new FloatingTextButton(
                playText,
                new DrawingInfos()
            {
                Position     = new Vector2(matrixScaleProvider.VirtualWidth / 2f, 850f),
                Origin       = _writingFont.GetTextCenter(playText),
                OverlayColor = _foregroundColor
            },
                _writingFont,
                () =>
            {
                gameOrchestrator.SetGameState();
            });

            var aboutText = localizedStringsRepository.Get(GameStringsLoader.AboutStringKey);

            _aboutButton = new FloatingTextButton(
                aboutText,
                new DrawingInfos()
            {
                Position     = new Vector2(matrixScaleProvider.VirtualWidth / 2f, 1150f),
                Origin       = _writingFont.GetTextCenter(aboutText),
                OverlayColor = _foregroundColor
            },
                _writingFont,
                () =>
            {
                gameOrchestrator.SetAboutState();
            });

            var currentScore = settingsRepository.GetOrSetInt(Definitions.SCORE_KEY, 0);

            _scoreText         = $"{localizedStringsRepository.Get(GameStringsLoader.ScoreStringKey)}:{currentScore}";
            _scoreDrawingInfos = new DrawingInfos()
            {
                Position     = new Vector2(matrixScaleProvider.VirtualWidth / 2f, matrixScaleProvider.VirtualHeight - 250f - 200f),
                Origin       = _writingFont.GetTextCenter(_scoreText),
                OverlayColor = _scoreColor,
                Scale        = 0.5f
            };
        }