Game flow. Controls the flow of the game states. (THE GAME STATE MACHINE!)
Наследование: MonoBehaviour
Пример #1
0
        public PlayerRankings(GameFlow gf)
        {
            InitializeComponent();

            db = gf.Db;
            Player[] users = db.getUserRanking();
            this.gf = gf;
            int rank = 1;

            foreach (Player player in users)
            {
                PlayerPanel pp = new PlayerPanel();

                pp.lblPalyerName.Content = player.Name;
                pp.lblPlayerLoss.Content = player.Loss;
                pp.lblPlayerRank.Content = rank++;
                pp.lblPlayerScore.Content = player.Score;
                pp.lblPlayerWins.Content = player.Win;
                pp.imgAvatar.Source = new BitmapImage(new Uri(player.Avatar));
                //imgPlayer.Source = new BitmapImage(new Uri(currentPlayer.Avatar));
                //ltvRankings.Items.Add(pp);

                Debug.WriteLine(player.Avatar);

                lstRanking.Items.Add(pp);
            }
        }
 static void S_1(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     cardPool.GetCard("Basic_000").priority = 5;
     cardPool.GetCard("Basic_001").priority = 5;
     cardPool.GetCard("Basic_002").priority = 5;
     cardPool.GetCard("Basic_003").priority = 5;;
 }
 static void S_12(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     cardPool.GetCard("Adv_000").priority = 30;
     cardPool.GetCard("Adv_001").priority = 30;
     cardPool.GetCard("Adv_002").priority = 30;
     cardPool.GetCard("Adv_003").priority = 30;;
 }
 public void Play(GameFlow flow)
 {
     InitPlay(flow);
     if (Flow.CurrentPlayer.IsHuman)
     {
         throw new InvalidOperationException("Don't use computer logic for a human");
     }
     do
     {
         if(ThrowFlow.State == ThrowFlowState.Throwing)
         {
             if(RainyWorm.All.Any(w => Flow.CanTakeRainyWorm(w))) 
             {
                 if (HandleThrowing())
                 {
                     return; // Stop when a rainyworm was taken
                 }
             }
             ThrowFlow.ThrowDices();
         }else if(ThrowFlow.State == ThrowFlowState.Taking)
         {
             // distinct thrown values that are not thrown yet
             var thrownValues = ThrowFlow.DicesToThrow
                     .Select(d => d.LastThrowDiceValue)
                     .Distinct()
                     .Where(thrown => ThrowFlow.DicesTaken.Select(d => d.LastThrowDiceValue).All(taken => taken != thrown));
             // check if there are any left to pick
             if (thrownValues.Any())
             {
                 HandleTaking(thrownValues);
             }
         }
     } while (ThrowFlow.CanStillThrowOrTake);
     Flow.TakeNothing();
 }
        public GamePlayerProfile(GameFlow gf, Database db)
        {
            InitializeComponent();
            this.gf = gf;
            this.db = db;

            initialize();
        }
Пример #6
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Destroys the board (by destroying the parent match).
    /// Moves the Game Flow forward by setting "Board Visible" to false.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        GameObject.Destroy(gameFlow.match.gameObject);

        animator.SetBool("Board Visible", false);
    }
Пример #7
0
 public void LevelStarted()
 {
     if (levelStarted)
     {
         return;
     }
     levelStarted = true;
     GameFlow.TriggerLevelStarted();
 }
Пример #8
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's exit event
    /// Sets up the GameFlow's event-based notifications from the current match.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateExit(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        //Debug.LogFormat("Removing WaitForPlayerBehavior.OnTurnEnded as a listener to the current match.");

        gameFlow.match.OnTurnEnded -= OnTurnEnded;
    }
Пример #9
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     UIController.Instance.chessFocus.Add(ChessType.黑子, UIController.Instance.rot_blackChess);
     UIController.Instance.chessFocus.Add(ChessType.白子, UIController.Instance.rot_whiteChess);
 }
Пример #10
0
    async UniTaskVoid Init()
    {
        var localUrl =
            $"file://{Path.GetFullPath(Path.Combine(Application.dataPath, localBaseCfgURL))}{Path.DirectorySeparatorChar}";

#if !UNITY_EDITOR
        useRemoteConfigs = true;
#endif

//        PlayerPrefs.SetString(_baseUrlKey, useRemoteConfigs ? remoteBaseCfgURL : localUrl);
//        PlayerPrefs.SetString(_charCfgUrlKey, charactersCfgURL);
//        PlayerPrefs.SetString(_userCfgUrlKey, userCfgURL);
//        PlayerPrefs.SetString(_cosmeticsCfgUrlKey, cosmeticsCfgURL);
//        PlayerPrefs.SetString(_questsCfgUrlKey, questsCfgURL);
//        PlayerPrefs.SetString(_lootboxCfgUrlKey, lootboxesCfgURL);
//        PlayerPrefs.Save();

        // await LoadConfigs();

#if UNITY_EDITOR || UNITY_STANDALONE_WIN
        {
            //GraphicsSettings.renderPipelineAsset = Resources.Load<RenderPipelineAsset>("Settings/LWRP-HighQuality");
        }
#else
        {
            //TODO: graphics settings

            var screenWidth  = Screen.currentResolution.width;
            var screenHeight = Screen.currentResolution.height;

            Screen.SetResolution(screenWidth / 2, screenHeight / 2, true);


            //GraphicsSettings.renderPipelineAsset = Resources.Load<RenderPipelineAsset>("Settings/LWRP-MediumQuality");
            Application.targetFrameRate = targetFrameRate;
            //QualitySettings.vSyncCount = 0;
        }
#endif

        var console = Instantiate(debugConsolePrefab);

        try
        {
            await BundlesManagerUtils.ResourcesUpToDate(updateBundles);
        }
        catch (Exception e)
        {
            UIManager.Popup <InfoPopup>().Text("Can't update data").Show();
        }
        finally
        {
            GameFlow.Init();
            GameFlow.MainMenu();
            //await GameFlow.Login(await LocalUser.GetLogin(), LocalUser.GetPassword());
        }
    }
Пример #11
0
    // --------------------------------------------------------------------------
    private void Awake()
    {
        if (_instance != null)
        {
            Destroy(gameObject);
            return;
        }

        _instance = this;
    }
Пример #12
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Starts the hide turn instruction animation of the match HUD.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        this.animator = animator;

        gameFlow.hud.matchHUD.OnHideTurnInstructionsFinished += OnHideTurnInstructionsFinished;
        gameFlow.hud.matchHUD.HideTurnInstructions();
    }
Пример #13
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// The entry point for the GameFlow. Begins the fade from black
    /// screen transition.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        this.animator = animator;

        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        gameFlow.hud.OnFadeEnded += OnFadeEnded;
        gameFlow.hud.BeginFade();
    }
        public void ScissorsAlwaysTiesScissors()
        {
            IPlayer playerOne = new ScissorsPlayer();
            IPlayer playerTwo = new ScissorsPlayer();

            GameFlow game   = new GameFlow(playerOne, playerTwo);
            Outcomes result = game.GetGameOutcome();

            Assert.AreEqual(Outcomes.Draw, result);
        }
Пример #15
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's start event
    /// Adds listeners for the events in <see cref="NewMatchDialog"/>. Advances
    /// the game flow when the NewMatchDialog has finished animating to a
    /// visible state.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        this.animator = animator;

        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        gameFlow.hud.newMatch.OnHideFinished += OnHideFinished;
        gameFlow.hud.newMatch.OnNewMatch     += OnNewMatch;
    }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     _gf            = FindObjectOfType <GameFlow>();
     sr             = GetComponent <SpriteRenderer>();
     sr.sprite      = _sprites[0]; // default - blank
     _board         = FindObjectOfType <Setup>()._board;
     _current       = false;
     _legalPosition = false;
     localTurnCount = _gf._turnCount;
 }
Пример #17
0
        public void StartNewGame()
        {
            GameFlow gf = new GameFlow();

            gf.Player1ShipPlacement();

            gf.Player2ShipPlacement();

            gf.GamePlay();
        }
Пример #18
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Waits for the player to click anywhere on the screen.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateUpdate(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        if (Input.GetMouseButtonDown(0))
        {
            animator.SetTrigger("Click Anywhere");
        }
    }
        public void RockAlwaysBeatsScissors()
        {
            IPlayer playerOne = new RockPlayer();
            IPlayer playerTwo = new ScissorsPlayer();

            GameFlow game   = new GameFlow(playerOne, playerTwo);
            Outcomes result = game.GetGameOutcome();

            Assert.AreEqual(Outcomes.PlayerOneWin, result);
        }
        public void PaperAlwaysBeatsRock()
        {
            IPlayer playerOne = new RockPlayer();
            IPlayer playerTwo = new PaperPlayer();

            GameFlow game   = new GameFlow(playerOne, playerTwo);
            Outcomes result = game.GetGameOutcome();

            Assert.AreEqual(Outcomes.PlayerTwoWin, result);
        }
        public void RockAlwaysTiesRock()
        {
            IPlayer playerOne = new RockPlayer();
            IPlayer playerTwo = new RockPlayer();

            GameFlow game   = new GameFlow(playerOne, playerTwo);
            Outcomes result = game.GetGameOutcome();

            Assert.AreEqual(Outcomes.Draw, result);
        }
Пример #22
0
        private IGameFlow GetTestGameFlowObject(
            out Mock <ITargetGenerator> mockTargetGenerator,
            out Mock <IAngleValidator> mockAngleValidator,
            out Mock <IVelocityValidator> mockVelocityValidator,
            out Mock <IShotCounter> mockShotCounter,
            out Mock <IXCoordinateCalculator> mockXCalculator,
            out Mock <IYCoordinateCalculator> mockYCalculator,
            Coordinate newTarget,
            bool isAngleValid,
            bool isVelocityValid,
            int shotCount,
            int xResult,
            int yResult)
        {
            mockTargetGenerator = new Mock <ITargetGenerator>();
            mockTargetGenerator.Setup(x => x.GetTarget())
            .Returns(newTarget);

            mockAngleValidator = new Mock <IAngleValidator>();
            mockAngleValidator.Setup(x => x.GetIsValid(It.IsAny <decimal>()))
            .Returns(isAngleValid);

            mockAngleValidator.Setup(x => x.GetErrorMessage())
            .Returns(MOCK_ANGLE_ERROR_MSG);

            mockVelocityValidator = new Mock <IVelocityValidator>();
            mockVelocityValidator.Setup(x => x.GetIsValid(It.IsAny <decimal>()))
            .Returns(isVelocityValid);

            mockVelocityValidator.Setup(x => x.GetErrorMessage())
            .Returns(MOCK_VELOCITY_ERROR_MSG);

            mockShotCounter = new Mock <IShotCounter>();
            mockShotCounter.Setup(x => x.AddShot(It.IsAny <int>()));
            mockShotCounter.Setup(x => x.GetCount())
            .Returns(shotCount);

            mockXCalculator = new Mock <IXCoordinateCalculator>();
            mockXCalculator.Setup(x => x.Get(It.IsAny <decimal>(), It.IsAny <decimal>()))
            .Returns(xResult);

            mockYCalculator = new Mock <IYCoordinateCalculator>();
            mockYCalculator.Setup(x => x.Get(It.IsAny <decimal>(), It.IsAny <decimal>()))
            .Returns(yResult);

            IGameFlow serviceToTest = new GameFlow(
                targetGenerator: mockTargetGenerator.Object,
                angleValidator: mockAngleValidator.Object,
                velocityValidator: mockVelocityValidator.Object,
                shotCounter: mockShotCounter.Object,
                xCalculator: mockXCalculator.Object,
                yCalculator: mockYCalculator.Object);

            return(serviceToTest);
        }
Пример #23
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Sets up the GameFlow's event-based notifications from the current match.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        gameFlow.match.OnMatchBegan += gameFlow.OnMatchBegan;
        gameFlow.match.OnMatchEnded += gameFlow.OnMatchEnded;
        gameFlow.match.OnGameEnded  += gameFlow.OnGameEnded;
        gameFlow.match.OnGameBegan  += gameFlow.OnGameBegan;
        gameFlow.match.BeginMatch();
    }
Пример #24
0
//        public class ObserverMessage : MessageBase
//        {
//            public Replay.Message Message;
//
//            public override void Serialize(NetworkWriter writer)
//            {
//                GeneratedNetworkCode._WriteMessage_Replay(writer, this.Message);
//            }
//
//            public override void Deserialize(NetworkReader reader)
//            {
//                this.Message = GeneratedNetworkCode._ReadMessage_Replay(reader);
//            }
//        }

        public void LaunchGame(bool spawnObjects = true)
        {
            MapLoader = new AssetLoader();
            MapLoader.LoadAssetBundle("Bundles/scenes/maps.bundle");
            MapLoader.LoadAsset(
                $"archive:/buildplayer-robotfactory_opu_gamemode/buildplayer-{GameConfig.Map.ToLower()}");
            MapLoader.ConstructCaches();

            AssetsLoader = new AssetLoader();
            AssetsLoader.LoadAsset("resources.assets");
            AssetsLoader.ConstructCaches();

            MiscLoader = new AssetLoader();
            MiscLoader.LoadAssetBundle("Bundles/scenes/frontend.bundle");
            MiscLoader.LoadAsset("archive:/buildplayer-options_ui/buildplayer-clientenvironmentsingletons");
            MiscLoader.ConstructCaches();

            if (!spawnObjects)
            {
                return;
            }

            SpawnObject(MiscLoader, "ApplicationSingletonsNetId", out _);
            SpawnObject(MiscLoader, "GameSceneSingletons", out var gameSceneSingletons);
            TheatricsManager  = gameSceneSingletons.GetComponent <TheatricsManager>();
            AbilityModManager = gameSceneSingletons.GetComponent <AbilityModManager>();
            SpawnObject(MiscLoader, "SharedEffectBarrierManager", out SharedEffectBarrierManager);
            SpawnObject(MiscLoader, "SharedActionBuffer", out SharedActionBuffer);
            SharedActionBuffer.Networkm_actionPhase = ActionBufferPhase.Done;

            SpawnScene(MapLoader, 1, out var commonGameLogic);
            InterfaceManager = commonGameLogic.GetComponent <InterfaceManager>();
            GameFlow         = commonGameLogic.GetComponent <GameFlow>();
//            MatchLogger = commonGameLogic.GetComponent<MatchLogger>();
            ServerCombatManager = commonGameLogic.GetComponent <ServerCombatManager>();
            ServerEffectManager = commonGameLogic.GetComponent <ServerEffectManager>();
            TeamStatusDisplay   = commonGameLogic.GetComponent <TeamStatusDisplay>();
            ServerActionBuffer  = commonGameLogic.GetComponent <ServerActionBuffer>();
            TeamSelectData      = commonGameLogic.GetComponent <TeamSelectData>();
            BarrierManager      = commonGameLogic.GetComponent <BarrierManager>();

            SpawnObject <Board, Board>(MapLoader, out Board);

            SpawnScene(MapLoader, 2, out BrushCoordinator);
            SpawnScene(MapLoader, 3, out var sceneGameLogic);
            GameFlowData       = sceneGameLogic.GetComponent <GameFlowData>();
            GameplayData       = sceneGameLogic.GetComponent <GameplayData>();
            SpoilsManager      = sceneGameLogic.GetComponent <SpoilsManager>();
            ObjectivePoints    = sceneGameLogic.GetComponent <ObjectivePoints>();
            SpawnPointManager  = sceneGameLogic.GetComponent <SpawnPointManager>();
            MatchObjectiveKill = sceneGameLogic.GetComponent <MatchObjectiveKill>();

            DumpNetObjects();
        }
Пример #25
0
    private void Awake()
    {
        main = this;

        if (PlayerPrefs.HasKey("gen"))
        {
            gen = PlayerPrefs.GetInt("gen");
        }

        text.text = "gen " + gen;
    }
Пример #26
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #27
0
        public void EndGame()
        {
            ActionApplier actionApplier = GetActionApplier(out ActionApplierContext actionApplierContext, false, false,
                                                           ActionApplierContext.EndGameSymbol);
            GameFlow flow = actionApplier.ApplyAction(new Board(), ActionApplierContext.EndGameSymbol);

            Assert.Equal(GameFlow.END_GAME, flow);
            actionApplierContext.MovementDisplayNamesResolver
            .Verify(mdnr => mdnr.TryResolve(Match.Create <string>(action => action == ActionApplierContext.EndGameSymbol), out movement), Times.Once);
            actionApplierContext.TileMover.Verify(tm => tm.TryMove(It.IsAny <Board>(), It.IsAny <Movement>(), out err), Times.Never);
        }
Пример #28
0
        public void ActionResolved_MovementDone()
        {
            ActionApplier actionApplier = GetActionApplier(out ActionApplierContext actionApplierContext, true, true, ACTION_NAME);
            GameFlow      flow          = actionApplier.ApplyAction(new Board(), ACTION_NAME);

            Assert.Equal(GameFlow.KEEP_PLAYING, flow);
            actionApplierContext.IO.Verify(io => io.WriteLine(It.IsAny <string>(), It.IsAny <int>()), Times.Never);
            actionApplierContext.MovementDisplayNamesResolver
            .Verify(mdnr => mdnr.TryResolve(Match.Create <string>(action => action == ACTION_NAME), out movement), Times.Once);
            actionApplierContext.TileMover.Verify(tm => tm.TryMove(It.IsAny <Board>(), It.IsAny <Movement>(), out err), Times.Once);
        }
Пример #29
0
        public void setGf(GameFlow gf)
        {
            this.gf = gf;
            db = gf.Db;
            updateCmbBox();

            if (GameFlow.P1First)
                rdaPlayer1.IsChecked = GameFlow.P1First;
            else
                rdaPlayer2.IsChecked = !GameFlow.P1First;
        }
Пример #30
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Clears GameFlow flags that were set in a previous match and activates the Title UI
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        hudTitle = gameFlow.hud.title;
        hudTitle.Show();

        animator.SetBool("Match Won", false);
        animator.SetBool("Game Ended", false);
    }
Пример #31
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's enter event
    /// Sets up listeners for <see cref="Match.OnTurnEnded"/>
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        this.animator = animator;

        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        gameFlow.BeginTurnPlay();
        //Debug.LogFormat("Adding WaitForPlayerBehavior.OnTurnEnded as a listener to the current match.");
        gameFlow.match.OnTurnEnded += OnTurnEnded;
    }
        public void OnClientResolutionPhaseCompleted(NetworkConnection conn, GameMessageManager.ClientResolutionPhaseCompleted msg)
        {
            Player    player = GameFlow.Get().GetPlayerFromConnectionId(conn.connectionId);
            ActorData actor  = GameFlowData.Get().FindActorByActorIndex(msg.ActorIndex);

            if (actor.gameObject.GetComponent <PlayerData>().m_player.m_connectionId != conn.connectionId)
            {
                Log.Warning($"OnClientResolutionPhaseCompleted: {actor.DisplayName} does not belong to player {player.m_accountId}!");
            }

            TheatricsPendingClients.Remove(player.m_accountId);
        }
Пример #33
0
 void Awake()
 {
     if (m_instance != null)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         m_instance = this;
     }
 }
Пример #34
0
    IEnumerator PerformEndCheck(GameFlow gf, bool[] esDone, int index)
    {
        while (GameObject.FindWithTag("Enemy") != null)
        {
            yield return(new WaitForSeconds(0.5f));
        }
        //done
        Debug.Log("current enemy wave done");
        esDone[0] = true;      //to turn spawner off only to be turned on again later

        gf.incrementPointer(); //move on to the line after GAME
    }
Пример #35
0
 public void Initialize()
 {
     Input.multiTouchEnabled = false;
     Localer.Init();
     CreatePauseListener();
     GameData         = new GameData();
     Settings         = new ZPlayerSettings();
     AtlasFramesCache = new AtlasFramesCache();
     GameFlow         = new GameFlow();
     EventManager     = new EventManager();
     CurrentMenu      = UISetType.Global;
 }
Пример #36
0
    /// <summary>
    /// The callback for a StateMachineBehaviour's start event
    /// Adds listeners for the events in <see cref="NewMatchDialog"/>. Advances
    /// the game flow when the NewMatchDialog has finished animating to a
    /// visible state.
    /// </summary>
    /// <param name="animator">The animator</param>
    /// <param name="stateInfo">The current state info</param>
    /// <param name="layerIndex">The current layer</param>
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);

        GameFlow gameFlow = animator.GetComponent <GameFlow>();

        gameFlow.hud.newMatch.OnShowFinished += OnShowFinished;
        gameFlow.hud.newMatch.gameObject.SetActive(true);
        gameFlow.hud.newMatch.Show();

        this.animator = animator;
    }
Пример #37
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (passed)
     {
         return;
     }
     if (other.CompareTag("Bird"))
     {
         passed = true;
         GameFlow.TriggerPassedObstacle();
     }
 }
Пример #38
0
        public TestRanking(GameFlow gf)
        {
            InitializeComponent();
            db = gf.Db;

            Player[] users = db.getUserRanking();
            this.gf = gf;

            foreach (Player player in users)
            {
                PlayerPanel pp = new PlayerPanel();
                pp.lblPalyerName.Content = player.Name;
                ltvRankings.Items.Add(pp);
            }
        }
Пример #39
0
        public GameGridView(GameFlow gf, Player player1, Player player2)
        {
            InitializeComponent();

            this.gf = gf;
            this.player1 = player1;
            this.player2 = player2;
            p1Moves = new bool[25];
            p2Moves = new bool[25];
            winningButtons = new int[3];
            db = gf.Db;

            initializeGame();
            initializePlayers();

            Debug.WriteLine("We are playing: " + GameFlow.Diff);
        }
Пример #40
0
    void Init()
    {
        mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>();

        //Default values
        mIsRaising = true;
        mDistanceMade = 0;

        // Cam
        mCam = Camera.main;
        mCamHeight = mCam.orthographicSize;

        // Get the camera's inital position
        mInitCamPos = mCam.transform.position;

        // Place Smoke at the bottom of the camera)
        transform.position = new Vector3(mInitCamPos.x, mInitCamPos.y - (mCamHeight * HEIGHT_FACTOR), 0.0f);
    }
Пример #41
0
 static void S_3(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fear += 5;;
 }
Пример #42
0
 void Init()
 {
     mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>();
     mGameMusic = GameObject.Find("GameMusic").GetComponent<GameMusic>();
     mSoundOn = true;
 }
Пример #43
0
 public void LoadLevel(GameFlow.Levels option)
 {
     switch (option)
     {
     case Levels.NEXT:
         Application.LoadLevel(LOADING);
         Invoke ("NextLevel", 3);
         break;
     case Levels.RESTART:
         Application.LoadLevel(LOADING);
         Invoke ("RestartLevel", 3);
         break;
     case Levels.QUICKRESTART:
         Application.LoadLevel(Application.loadedLevelName);
         break;
     }
 }
Пример #44
0
 static void S_7(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fear = 100;;
 }
Пример #45
0
 void Awake()
 {
     Instance = this;
 }
Пример #46
0
 //On Start
 void Start()
 {
     //Get the proper component
     game = GetComponent<GameFlow>();
     //Disable the game saved cCanvas
     cCanvas.enabled = false;
     //Create a directory for the data to be stored
     Directory.CreateDirectory(Application.dataPath + "/GameData/State");
     //Create a directory for the data to be stored
     Directory.CreateDirectory(Application.dataPath + "/GameData/PlayerParty");
     //Create a directory for the data to be stored
     Directory.CreateDirectory(Application.dataPath + "/GameData/EnemyParty");
     //Create a directory for the data to be storedd
     Directory.CreateDirectory(Application.dataPath + "/GameData");
     //Create a directory for the data to be stored
     Directory.CreateDirectory(Application.dataPath + "/GameData/VictoryParty");
 }
Пример #47
0
 static void S_11(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Approval +=10;;
 }
Пример #48
0
 public void init()
 {
     gameFlow = gameObject.GetComponent<GameFlow>();
     skill = gameObject.GetComponent<Skill>();
 }
Пример #49
0
 public GameMenu(GameFlow gf)
 {
     InitializeComponent();
     this.gf = gf;
     userLogin.setGf(gf);
 }
Пример #50
0
    // game wide state change, example: an alarm was triggered
    private void OnPhaseChange(GameFlow.GamePhase previousState, GameFlow.GamePhase currentState)
    {
        if (previousState == GameFlow.GamePhase.Start && currentState == GameFlow.GamePhase.Spawn)
        {
            currentTile = WorldGrid.Instance.ObjectInGridTile(transform);
            OnStartAction();
        }

        if (previousState == GameFlow.GamePhase.Plan && currentState == GameFlow.GamePhase.Action)
            OnNormalAction();

        if (currentState == GameFlow.GamePhase.Alarm)
            OnAlarm();

        if (previousState == GameFlow.GamePhase.Alarm && currentState == GameFlow.GamePhase.Action)
            OnAlarmAction();
    }
 /// <summary>
 /// Init data that is reused often the same play
 /// </summary>
 protected virtual void InitPlay(GameFlow flow)
 {
     Flow = flow;
     WormsToSteal = Flow.Players.Where(p => p != Flow.CurrentPlayer && p.WormsWon.Any()).Select(p => p.TopWorm);
     ThrowFlow = Flow.CurrentTurn;
 }
Пример #52
0
 // Use this for initialization
 void Start()
 {
     mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>();
     mText = GetComponent<Text>();
     mText.text = "Collectables: " + mGameFlow.GetCollectableCount().ToString() + "/3";
 }
Пример #53
0
 void Awake()
 {
     mainFlow = this;
 }
Пример #54
0
 static void S_4(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Approval +=5;
     memory.Fear +=5;;
 }
Пример #55
0
        /// <summary>
        /// Initializes component.
        /// </summary>
        protected override void OnInitializeComponent()
        {
            /* create flow */
            this.flow = new GameFlow();

            /* first get element service to create member objects */
            IElementService elements = this.GetElementService();

            if (elements != null)
            {
                this.countDown = elements.CreateCountDown();

                this.pipeQueue = elements.CreatePipeQueue();
                this.squareMap = elements.CreateSquareMap();

                this.squareMap.ActiveItemChanged += new EventHandler<EventArgs<ISquareMapItemElement>>(OnSquareMapActiveItemChanged);
            }

            /* second get game service and initialize bindings */
            IGameService game = this.GetGameService();

            if (game != null)
            {
                this.startBinding = game.CreateBinding(GameCommands.Game.Start);
                if (this.startBinding != null)
                {
                    this.startBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGameStart);
                }

                this.presentCompleteBinding = game.CreateBinding(GameCommands.Game.PresentComplete);
                if (this.presentCompleteBinding != null)
                {
                    this.presentCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGamePresentComplete);
                }

                this.readyToPlayCompleteBinding = game.CreateBinding(GameCommands.Game.ReadyToPlayComplete);
                if (this.readyToPlayCompleteBinding != null)
                {
                    this.readyToPlayCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGameReadyToPlayComplete);
                }

                this.playAgainCompleteBinding = game.CreateBinding(GameCommands.Game.PlayAgainComplete);
                if (this.playAgainCompleteBinding != null)
                {
                    this.playAgainCompleteBinding.Executed += new EventHandler<EventArgs<ICommand>>(OnGamePlayAgainComplete);
                }
            }

            /* call base to finalize */
            base.OnInitializeComponent();
        }
Пример #56
0
    // Init all the variables that needs to be
    private void Init()
    {
        mGameFlow = GameObject.Find ("GameFlow").GetComponent<GameFlow>();
        mGameFlow.PauseSmoke (false);
        mRenderer = GetComponent<SpriteRenderer>();
        mRenderer.color = BASE_COLOR;
        mBody = GetComponent<Rigidbody2D>();
        mToxicity = 0.3f;
        mPrevToxicity = 0.0f;
        mOpacity = 1;
        mTmpOpacity = mOpacity;
        mCurrentSpeed = mSpeed;
        mTmpMaxSpeed = mMaxSpeed;
        mCollectablesCount = 0;
        mInAir = false;
        mIsdead = false;
        mCurrentDirection = DIRECTION_LEFT;
        mGameMusic = GameObject.Find ("GameMusic").GetComponent<GameMusic>();
        mAnimator = GetComponent<Animator>();
        mGameMusic.PlayMusic(GameMusic.Songs.LEVEL);
        mTimerOn = true;
        mTimer = MAX_TIMER;
        mToxicTimerOn = false;
        mToxicTimer = 0.0f;

        mFolder1.enabled = true;
        mFolder2.enabled = true;
        mFolder3.enabled = true;

        mRight = Vector2.right;
        mLeft = -Vector2.right;
    }
Пример #57
0
 static void S_2(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fund += 5;
 }