Exemplo n.º 1
0
    private IEnumerator UsingFacilityWait(float waitTime)
    {
        if (currentTarget is GameMachine)
        {
            GameMachine machine = (GameMachine)currentTarget;
            machine.IncreaseCurrentNumberOfPlayers();
            this.GetComponent <Animator>().SetTrigger("Sit");
        }

        currentTarget.OnUse();

        customerTransform.LookAt(currentTarget.transform);
        customerTransform.position = currentTarget.GetUsePosition().position;

        yield return(new WaitForSeconds(waitTime / speedFactor));

        if (currentTarget is GameMachine)
        {
            GameMachine machine = (GameMachine)currentTarget;
            machine.DecreaseCurrentNumberOfPlayers();
            this.GetComponent <Animator>().SetTrigger("Get Up");
        }

        currentTarget.InUse = false;
        currentState        = CustomerStates.Idle;
    }
Exemplo n.º 2
0
 public void Register(GameMachine.Core.Behavior behavior, params string[] names)
 {
     for (int i = 0; i < names.Length; i++) {
         string name = Char.ToLowerInvariant (names [i] [0]) + names [i].Substring (1);
         behaviorGameMessages [name] = behavior;
     }
 }
Exemplo n.º 3
0
 public SpawnState(GameMachine game, IState previousState, SpawnAbilitySelectionUIContainer spawnUIContainer) : base(game, previousState)
 {
     gmMachine             = game;
     this.spawnUIContainer = spawnUIContainer;
     // MOVE => Pinto Las Tiles
     // ATTACK => Selecciono las tiles a atacar y marco a los enemigos como van a quedar de vida ?
     // SPAWN => Pinto las tiles y marco a las unidades combinables
 }
Exemplo n.º 4
0
 public void GameMachineRepository_GetGamemachineById_with_GameData()
 {
     using (var transaction = new TransactionScope())
     {
         GameMachine gm = CreateMockGameMachine();
         sut.AddGamemachine(gm);
         var result = sut.GetGamemachineById(Convert.ToString(gm.Id));
         result.ShouldNotBeNull();
     }
 }
Exemplo n.º 5
0
 public void GameMachineRepository_DeleteGamemachine_with_GameId()
 {
     using (var transaction = new TransactionScope())
     {
         GameMachine gm = CreateMockGameMachine();
         sut.AddGamemachine(gm);
         var result = sut.DeleteGamemachine(Convert.ToString(gm.Id));
         result.ShouldBeTrue();
     }
 }
Exemplo n.º 6
0
 public void GameMachineRepository_GetAllGamemachines_with_GameData()
 {
     using (var transaction = new TransactionScope())
     {
         GameMachine gm = CreateMockGameMachine();
         sut.AddGamemachine(gm);
         var result = sut.GetAllGameMachines();
         result.Count().ShouldBeGreaterThan(0);
     }
 }
 // Add Game machine
 public string AddGamemachine(GameMachine gamemachine)
 {
     if (_gamerepo.AddGamemachine(gamemachine))
     {
         return("Game machine details added successfully");
     }
     else
     {
         return("Invalid Game machine details.");
     }
 }
Exemplo n.º 8
0
 public override void Begin(GameMachine context)
 {
     this.context = context;
     playerController.gameObject.SetActive(false);
     enemyController.gameObject.SetActive(false);
     turnsUI.gameObject.SetActive(false);
     experiencePointsUI.gameObject.SetActive(false);
     placementManager.gameObject.SetActive(true);
     levelProgress?.gameObject.SetActive(false);
     PlacementPhaseStarted?.Invoke();
 }
 //Update Game Machine
 public string UpdateGamemachine(GameMachine gamemachine)
 {
     if (_gamerepo.UpdateGamemachine(gamemachine))
     {
         return("Game machine details updated successfully");
     }
     else
     {
         return("Invalid Game machine details.");
     }
 }
        //Game machine by Id
        public GameMachine GetGamemachineById(string id)
        {
            int         gid    = 0;
            GameMachine result = null;

            if (int.TryParse(id, out gid))
            {
                var gamemachineId = Convert.ToInt32(id);
                result = contextObj.gamemachine.Find(gamemachineId);
            }
            return(result);
        }
Exemplo n.º 11
0
 public override void Begin(GameMachine context)
 {
     Logcat.I($"Starting results state. Has player won? {gameplayState.HasPlayerWon}");
     if (gameplayState.HasPlayerWon)
     {
         resultsPanel.RaiseWin();
     }
     else
     {
         resultsPanel.RaiseLose();
     }
 }
Exemplo n.º 12
0
 public void GameMachineRepository_UpdateGamemachine_with_GameData()
 {
     using (var transaction = new TransactionScope())
     {
         GameMachine gm  = CreateMockGameMachine();
         GameMachine ugm = CreateMockGameMachine();
         sut.AddGamemachine(gm);
         ugm.Id = gm.Id;
         var result = sut.UpdateGamemachine(ugm);
         result.ShouldBeTrue();
     }
 }
Exemplo n.º 13
0
        public void TestForFlush()
        {
            string      hand  = "2H 3H 5H 2H 7H";
            GameMachine gm    = new GameMachine("player1", "player2");
            List <Card> cards = GetCard(hand);


            bool expected = true;
            bool actual   = gm.CheckForFlush(cards);


            Assert.Equal(expected, actual);
        }
Exemplo n.º 14
0
        public void TestForStraight()
        {
            string      hand  = "TH 9S 8D 7S 6C";
            GameMachine gm    = new GameMachine("player1", "player2");
            List <Card> cards = GetCard(hand);


            bool expected = true;
            bool actual   = gm.CheckForStraight(cards);


            Assert.Equal(expected, actual);
        }
Exemplo n.º 15
0
 private void Awake()
 {
     if (GameMachine.Instance == null && GameMachine.Instance != this)
     {
         instance    = this;
         initalState = CreateState(startState);
         ForceState(initalState);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 16
0
        public void TestForFourOfAKind()
        {
            string      hand  = "5C 5S 5H 5D 7H";
            GameMachine gm    = new GameMachine("player1", "player2");
            List <Card> cards = GetCard(hand);


            bool expected = true;
            bool actual   = gm.CheckForFourOfAKind(cards);


            Assert.Equal(expected, actual);
        }
Exemplo n.º 17
0
        public void TestForFullHouse()
        {
            string      hand  = "3C 3H 3S 2S 2H";
            GameMachine gm    = new GameMachine("player1", "player2");
            List <Card> cards = GetCard(hand);


            bool expected = true;
            bool actual   = gm.CheckForFullHouse(cards);


            Assert.Equal(expected, actual);
        }
Exemplo n.º 18
0
    public override async Task OnEnter(GameState previous = null)
    {
        Debug.Log("Entered Inital");
        gm = GameMachine.Instance;
        await gm.Loading.Deactive();

        splash = GameObject.FindObjectOfType <SplashUI>();
        if (splash == null)
        {
            throw new System.Exception("Splash UI not found in current scene");
        }
        await splash.Show();

        GameMachine.Instance.NewState(new MenuState());
    }
Exemplo n.º 19
0
 IEnumerator run()
 {
     while (codePointer.MoveNext())
     {
         object retval       = codePointer.Current;
         var    requestGoSub = retval as GameMachineGoSub;
         if (requestGoSub != null)
         {
             var sub = new GameMachine()
             {
                 codePointer     = requestGoSub.CodePointer,
                 dynamicDispatch = this.dynamicDispatch,
             };
             var subCodePointer = sub.run();
             while (subCodePointer.MoveNext())
             {
                 yield return(subCodePointer.Current);
             }
             continue;
         }
         var requestGoTo = retval as GameMachineGoTo;
         if (requestGoTo != null)
         {
             codePointer = requestGoTo.Code.Invoke();
             continue;
         }
         if (retval != null)
         {
             var queryCodePointer = (IEnumerator)dynamicDispatch(retval);
             if (queryCodePointer == null)
             {
                 continue;
             }
             while (queryCodePointer.MoveNext())
             {
                 yield return(queryCodePointer.Current);
             }
             continue;
         }
         else
         {
             yield return(null);
         }
     }
 }
        // Add Game machine
        public bool AddGamemachine(GameMachine gamemachine)
        {
            bool result = false;

            if (gamemachine != null)
            {
                using (var scope = new TransactionScope())
                {
                    contextObj.gamemachine.Add(gamemachine);
                    contextObj.SaveChanges();
                    scope.Complete();
                    result = true;

                    logger.Info("Added GameMachine. " + gamemachine.MachineName);
                }
            }
            return(result);
        }
        //Update Game Machine
        public bool UpdateGamemachine(GameMachine gamemachine)
        {
            bool result = false;

            if (gamemachine != null)
            {
                int gamemachineId = Convert.ToInt32(gamemachine.Id);
                using (var scope = new TransactionScope())
                {
                    GameMachine _gamemachine = contextObj.gamemachine.Where(b => b.Id == gamemachineId).FirstOrDefault();
                    _gamemachine.MachineName = gamemachine.MachineName;
                    _gamemachine.Description = gamemachine.Description;
                    _gamemachine.Vendor      = gamemachine.Vendor;
                    _gamemachine.MachineType = gamemachine.MachineType;
                    contextObj.SaveChanges();
                    scope.Complete();
                    result = true;

                    logger.Info("Updated GameMachine. " + gamemachine.MachineName);
                }
            }
            return(result);
        }
Exemplo n.º 22
0
 public TakeCardAbilityButtonExecution(IOcuppy actualOccupier, GameMachine gameCreator, AbilityButtonCreationUI abilityButtonCreationUI)
 {
     this.game                    = gameCreator;
     this.actualOccupier          = actualOccupier;
     this.abilityButtonCreationUI = abilityButtonCreationUI;
 }
 private void Awake()
 {
     gameMachine = FindObjectOfType <GameMachine>();
 }
Exemplo n.º 24
0
 public TurnState(int duration, GameMachine game) : base(game, duration)
 {
     this.gmMachine = game;
     stateName      = "TURN STATE";
 }
 public InitialAdministrationStateBase(int duration, GameMachine game, int managmentPoints) : base(duration, game, managmentPoints)
 {
 }
 public SelectCardTargetState(GameMachine game, IState previousState, MoveAbilitySelectionUIContainer moveUIContainer, IOcuppy mover) : base(game, previousState)
 {
     gmMachine            = game;
     this.moveUIContainer = moveUIContainer;
     this.mover           = mover;
 }
Exemplo n.º 27
0
 public override void TransitionIn(GameMachine machine)
 {
     if (machine.AudioSource == null)return;
     machine.AudioSource.PlayRandomIntroClip();
 }
Exemplo n.º 28
0
 public override void Act(GameMachine machine)
 {
     if (machine.AudioSource == null) return;
     var shouldPlaySound = Random.value > 0.993;
     if (!shouldPlaySound)return;
     machine.AudioSource.PlayRandomInGameQuip();
 }
Exemplo n.º 29
0
 public virtual void TransitionOut(GameMachine machine)
 {
 }
Exemplo n.º 30
0
 public virtual void Act(GameMachine machine)
 {
 }
 public AdministrationState(int duration, GameMachine game, int managmentPoints) : base(game, duration)
 {
     this.managmentPoints = managmentPoints;
     this.gmMachine       = game;
     stateName            = "ADMINISTRATION STATE";
 }
Exemplo n.º 32
0
 public TakeCardState(GameMachine game, IState previousState) : base(game, previousState)
 {
     gmMachine = game;
 }
Exemplo n.º 33
0
 public InitialAdministrationStateB(int duration, GameMachine gmMachine, int mngPoints) : base(duration, gmMachine, mngPoints)
 {
     stateName = "INITIAL ADMINISTRATION STATE B";
     nextState = new InitialAdministrationStateC(20, gmMachine, 2);
 }