Beispiel #1
0
 void Start()
 {
     Load();
     current  = this;
     scoreTxt = scoreTxtObject.GetComponent <Text>();
     hpTxt    = hpTxtObject.GetComponent <Text>();
 }
Beispiel #2
0
        public GameplayScript LoadBoard(RuleSettings ruleSettings)
        {
            //print($"[GAME] Loading board - ruleset name: {ruleSettings.PuzzleNameKey}");

            player = SceneActivationBehaviour <GameLogicActivator> .Instance.GameController.Player;

            for (int i = 0; i < boardPlaceHolder.transform.childCount; i++)
            {
                Destroy(boardPlaceHolder.transform.GetChild(i));
            }

            backgroundImage.sprite = ruleSettings.BoardBackgroundImage;
            FreshBoard             = Instantiate(boardPrefab, boardPlaceHolder.transform);

            boardCreationScript = FreshBoard.GetComponent <BoardCreationScript>();
            boardGameplayScript = FreshBoard.GetComponent <GameplayScript>();

            boardCreationScript.InitiateBoard(ruleSettings);
            bonusBarUIActivator.InitiateBonusBar(ruleSettings, boardGameplayScript);

            Vector3 boardScale = boardPlaceHolder.transform.localScale;

            SceneActivationBehaviour <PostGameSceneActivator> .Instance.SetBoardHolderScale(boardScale);

            TrySpawnQuixel();

            return(boardGameplayScript);
        }
 private void GetDependencies()
 {
     field    = GameObject.FindObjectOfType <FieldScript>();
     gameplay = GameObject.FindObjectOfType <GameplayScript>();
     timer    = GameObject.FindObjectOfType <TimerScript>();
     app      = GameObject.FindObjectOfType <AppScript>();
     tutorial = GameObject.FindObjectOfType <TutorialScript>();
 }
Beispiel #4
0
    void Awake()
    {
        samurai = GameObject.Find("Player");
        samuraiMain = samurai.GetComponent<SamuraiMain>();

        gamePlay = GameObject.Find("Gameplay");
        gameplayScript = gamePlay.GetComponent<GameplayScript>();
    }
Beispiel #5
0
 void Start()
 {
     Time.timeScale = 1f;
     if (instance == null)
     {
         instance = this;
     }
 }
    void Awake()
    {
        InProgress = false;
        GameplayScript temp = gameObject.GetComponent <GameplayScript>(); //GameObject.Find("Gameplay Manager").GetComponent<GameplayScript>();

        temp.OnGameEnded   += GameEnded;
        temp.OnGameStarted += GameStarted;
    }
Beispiel #7
0
        public override void ReCreate(Transform objectPrefab)
        {
            base.ReCreate(objectPrefab);

            GameplayScript script = GameObjectTransform.gameObject.GetComponent <GameplayScript>();

            script.OnMouseDownEvent += ScriptOnOnMouseDownEvent;
        }
Beispiel #8
0
    public void loadContent(GameplayScript script)
    {
        // GETTING SPRITE REFERENCES
        this.script       = script;
        this.sprTarget    = script.target;
        this.sprCollision = script.collision;

        loadLevel();
    }
Beispiel #9
0
 void Start()
 {
     blasterRef     = Resources.Load("Blaster");
     animator       = GetComponent <Animator>();
     rigidbody      = GetComponent <Rigidbody2D>();
     gameplayScript = GetComponent <GameplayScript>();
     spawnerScript  = GetComponent <SpawnerScript>();
     needRespawn    = false;
     isGameOver     = false;
 }
Beispiel #10
0
        public void StartGame(Player player,
                              RuleSettings selectedRuleset,
                              FtueController ftueController,
                              SessionScript sessionScript,
                              OverlayUISceneActivator overlayUISceneActivator)
        {
            print("[FTUE] Fifth ftue game started ");

            InterfaceController.Instance.Show(GameWindow.OverlayUIScene);
            InterfaceController.Instance.Hide(GameWindow.MainMenu);

            SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(false);

            GameplayScript      gameplay            = sessionScript.CreateGameAndStart(player, selectedRuleset);
            BoardCreationScript boardCreationScript = gameplay.GetComponent <BoardCreationScript>();

            InterfaceController.Instance.Show(GameWindow.BonusBarUI);
            SceneActivationBehaviour <BonusBarUIActivator> .Instance.ShowDim(true);

            InterfaceController.Instance.Hide(GameWindow.ToolbarUI);

            boardCreationScript.BlockAllCells();

            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FourthGame.FtueMessages.Instructions4_1, true, true, 0, true);

            ftueController.SendFtueProgress("Game4StartStarBar_27");

            overlayUISceneActivator.SubscribeForFullScreenTap(() =>
            {
                SceneActivationBehaviour <BonusBarUIActivator> .Instance.ShowDim(false);

                ftueController.SendFtueProgress("ReadyStart_28");
                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FourthGame.FtueMessages.Instructions4_2, true, true, 0, true);

                overlayUISceneActivator.SubscribeForFullScreenTap(() =>
                {
                    ftueController.SendFtueProgress("StartGame4_29");

                    overlayUISceneActivator.HideFtueMessages();

                    overlayUISceneActivator.ftueMessagesPerStage = 0;
                    gameplay.StartDelayedSession();

                    boardCreationScript.UnblockAllCells();

                    gameplay.OnPuzzleSolved += gameData =>
                    {
                        int i = int.Parse(gameData.Ruleset.Id);
                        ftueController.ProceedToGameOverAward(player, i);

                        ftueController.SendFtueProgress("Game4Complete_30");
                    };
                });
            });
        }
Beispiel #11
0
 void Damage()
 {
     --health;
     onPlayerDamageEvent?.Raise();
     GameplayScript.SetHpUI(health < 0 ? 0 : health);
     if (health <= 0)
     {
         OnPlayerDeath();
     }
     else
     {
         coroutine = StartCoroutine(TemporaryImmunity());
     }
 }
    void OnCollisionEnter(Collision collision)
    {
        //gameplayScript.EndGame();

        //Debug.Log(collision.gameObject.transform.name);

        GameplayScript gs = collision.gameObject.GetComponent <GameplayScript>();

        if (gs != null)
        {
            gs.EndGame();
        }
        else
        {
            Debug.Log("NIEWŁAŚCIWY OBIEKT WYKRYWA KOLIZJĘ");
        }
    }
Beispiel #13
0
    void Awake()
    {
        skriptaInsta = GameObject.Find("SkriptaInsta");
        bloodInsta = skriptaInsta.GetComponent<BloodInsta>();

        gamePlayScriptObject = GameObject.Find("Gameplay");
        gamePlayScript = gamePlayScriptObject.GetComponent<GameplayScript>();

        anim = GetComponent<Animator>();
        myBoxCollider = gameObject.GetComponent<BoxCollider2D>();
        myCircleCollider = gameObject.GetComponent<CircleCollider2D>();

        samurai = GameObject.Find("Player");
        samuraiMain = samurai.GetComponent<SamuraiMain>();
        samuraiAnimator = samurai.GetComponent<Animator>();
        murderReported = false;
    }
        public void ListenForCurrentFtueCellMarking(GameplayScript gameplay = null, List <Vector2> targetCoordinatesForCurrentStep = null, Action targetCellsMarked = null)
        {
            List <Vector2> markedCells = new List <Vector2>();

            gameplay.OnFtueCellMark += (CellCoordinate, AddorRemove) =>
            {
                if (AddorRemove)
                {
                    markedCells.Add(CellCoordinate);
                }

                if (CheckCorrectCells(markedCells, targetCoordinatesForCurrentStep))
                {
                    targetCellsMarked?.Invoke();
                    return;
                }
            };
        }
        public void ListenForSecondSpecificSelection(GameplayScript gameplay = null, List <Vector2> targetCells = null, Action rowTwoSelected = null)
        {
            List <Vector2> secondRowCells = targetCells;
            List <Vector2> selectedCells  = new List <Vector2>();

            gameplay.OnFtueCellSelection += (CellCoordinate, AddorRemove) =>
            {
                if (AddorRemove)
                {
                    selectedCells.Add(CellCoordinate);
                }

                if (CheckCorrectCells(selectedCells, secondRowCells))
                {
                    rowTwoSelected?.Invoke();
                    return;
                }
            };
        }
        public void InitiateBonusBar(RuleSettings ruleSettings, GameplayScript BoardGameplayScript)
        {
            boardGameplayScript = BoardGameplayScript;

            // Instate default values for that board
            timeLimit = ruleSettings.TimeLimit;

            twoStarSecondsLimit   = Mathf.RoundToInt(timeLimit / 100 * ruleSettings.TwoStarLimitPercentage);
            threeStarSecondsLimit = Mathf.RoundToInt(timeLimit / 100 * ruleSettings.ThreeStarLimitPercentage);

            starTwo.SetStarPosition(ruleSettings.TwoStarLimitPercentage);
            starThree.SetStarPosition(ruleSettings.ThreeStarLimitPercentage);

            bonusBarImageFill.fillAmount = 1;
            fillAmountIncrement          = 1 / timeLimit;

            thirdStarLost  = false;
            secondStarLost = false;
        }
Beispiel #17
0
    void OnTriggerExit(Collider other)
    {
        //rigidbodies.Remove(other.attachedRigidbody);
        if (other.attachedRigidbody.name.Contains("Car"))
        {
            GameplayScript script = other.attachedRigidbody.gameObject.GetComponent <GameplayScript>();

            if (rigidbodies.ContainsKey(script))
            {
                int temp = rigidbodies[script]--;

                temp--;

                if (temp == 0)
                {
                    rigidbodies.Remove(script);
                }
            }
        }
    }
        public void ListenForCurrentFtueCellSelection(GameplayScript gameplay = null, List <Vector2> targetCoordinatesForCurrentStep = null, Action oneCellSelected = null, Action targetCellsSelected = null)
        {
            List <Vector2> selectedCells = new List <Vector2>();

            gameplay.OnFtueCellSelection += (CellCoordinate, AddorRemove) =>
            {
                oneCellSelected?.Invoke();

                if (AddorRemove)
                {
                    selectedCells.Add(CellCoordinate);
                }

                if (CheckCorrectCells(selectedCells, targetCoordinatesForCurrentStep))
                {
                    targetCellsSelected?.Invoke();
                    return;
                }
            };
        }
        public void ListenForSecondSpecificMarking(GameplayScript gameplay = null, Action columnTwoSelected = null)
        {
            List <Vector2> secondColumnCells = new List <Vector2> {
                new Vector2(2, 5), new Vector2(5, 5)
            };
            List <Vector2> markedCells = new List <Vector2>();

            gameplay.OnFtueCellMark += (CellCoordinate, AddorRemove) =>
            {
                if (AddorRemove)
                {
                    markedCells.Add(CellCoordinate);
                }

                if (CheckCorrectCells(markedCells, secondColumnCells))
                {
                    columnTwoSelected?.Invoke();
                    return;
                }
            };
        }
Beispiel #20
0
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log(other.gameObject.name);

        if (other.attachedRigidbody.name.Contains("Car"))
        {
            GameplayScript gameplayScript = other.attachedRigidbody.gameObject.GetComponent <GameplayScript>();

            if (rigidbodies.ContainsKey(gameplayScript))
            {
                rigidbodies[gameplayScript]++;
            }

            if (gameplayScript.AddWaypointIndex(WaypointID))
            {
                Vector3 collisionPosition = other.gameObject.GetComponent <Collider>().ClosestPointOnBounds(transform.position);

                gameplayScript.SetWaypointPosition(collisionPosition);
                gameplayScript.SetNormalToWaypoint(Normal);
                gameplayScript.IncreaseScore(BonusPointsForCrossing);

                //Debug.Log("Waypoint " + WaypointID + ", point: " + collisionPosition);

                rigidbodies.Add(gameplayScript, 1);

                if (IsFinishLine)
                {
                    gameplayScript.ClearWaypointIndexes();
                }
            }
            else
            {
                if (!rigidbodies.ContainsKey(gameplayScript))
                {
                    //Debug.Log("COFNĄŁ SIĘ - UBIT");
                    gameplayScript.EndGame();
                }
            }
        }
    }
    /// <summary>
    /// Damages the player.
    /// </summary>
    /// <param name="hp">[not needed] Hit points</param>
    public void Damage(float hp = 1)
    {
        //if it has temp immunity, do nothing
        if (isTempImmune)
        {
            return;
        }

        --health;

        //activates the event (sounds) and updates hud
        onPlayerDamageEvent?.Raise();
        GameplayScript.SetHpUI(health < 0 ? 0 : health);

        if (health <= 0)
        {
            OnPlayerDeath();
        }
        else
        {
            //if it has health left, call the temp immunity
            coroutine = StartCoroutine(TemporaryImmunity());
        }
    }
Beispiel #22
0
    void DrawButton()
    {
        if (isShow)
        {
            Time.timeScale = 0;
        }
        //if(isShow)
        {
            //Draw background
            GUI.DrawTexture(new Rect(maxRight, -Screen.height / 20.0f, Screen.width / 4.0f, Screen.height * 1.1f), boxBg);
            //Draw level label
            GUI.Label(new Rect(maxButtonRight + Screen.width / 8 - 75, Screen.height / 8f, 150, Screen.height / 12f), "");
            //Calculate buttons' width
            scaleWidth = Screen.height / 6f;
            //Draw list levels button
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 2 / 10.0f, scaleWidth, scaleWidth), textures[0], "trans_button"))
            {
                Debug.Log("menu");
                Time.timeScale = 1;
                GameplayScript.DoChooseLevels();
                isShow = false;

                //--------------------------------
                //Load list level in here
                //--------------------------------
            }
            //Draw replay button
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 4 / 10.0f, scaleWidth, scaleWidth), textures[1], "trans_button"))
            {
                Debug.Log("restart");
                Time.timeScale = 1;
                GameplayScript.DoReplay();
                isShow = false;

                //------------------------------
                //Do replay function in here
                //-----------------------------
            }
            //Draw sound button
            Texture soundButton = SoundEffect.isMute?textures[2]:textures[3];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 6 / 10.0f, scaleWidth, scaleWidth), new GUIContent(soundButton), "trans_button"))
            {
                Debug.Log("som");
                Time.timeScale     = 1;
                isShow             = false;
                SoundEffect.isMute = !SoundEffect.isMute;
                if (!SoundEffect.isMute)
                {
                    SoundEffect.Stop();
                }
                else
                {
                    SoundEffect.Play(Sound.tone);
                }
                MusicEffect.isMute = !MusicEffect.isMute;
                if (MusicEffect.isMute)
                {
                    MusicEffect.Stop();
                }
                else
                {
                    MusicEffect.Play(Music.tone);
                }
            }
            //Draw how to play button
            Texture helpButton = textures[4];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 16 - scaleWidth / 2, Screen.height * 8 / 10.0f, scaleWidth, scaleWidth), new GUIContent(helpButton), "trans_button"))
            {
                Debug.Log("?");

                //isShow = false;
                isShowHelp = true;
            }
            //Draw info button
            Texture infoButton = textures[5];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width * 3 / 16 - scaleWidth / 2, Screen.height * 8 / 10.0f, scaleWidth, scaleWidth), new GUIContent(infoButton), "trans_button"))
            {
                Debug.Log("!");
                Time.timeScale = 1;
                isShow         = false;
                //Application.OpenURL("http://www.odigamestudio.com");
            }
            //Draw transparent area
            if (isShow && GUI.Button(new Rect(maxLeft, 0, Screen.width * 3 / 4.0f, Screen.height), "", "trans_button"))
            {
                Debug.Log("fora");
                Time.timeScale = 1;
                isShow         = false;
            }
        }
        //Draw pauseButton
        if (GUI.Button(new Rect(5, 5, scaleWidth * 5 / 7f, scaleWidth * 5 / 7f), pauseButton, "trans_button"))
        {
            Debug.Log("pause");
            isShow         = !isShow;
            Time.timeScale = 1;
        }
    }
Beispiel #23
0
        public void StartGame(Player player,
                              RuleSettings selectedRuleset,
                              FtueController ftueController,
                              SessionScript sessionScript,
                              OverlayUISceneActivator overlayUISceneActivator)
        {
            print("[FTUE] First ftue game started " + overlayUISceneActivator.name);

            InterfaceController.Instance.Show(GameWindow.OverlayUIScene);
            InterfaceController.Instance.Hide(GameWindow.MainMenu);

            SceneActivationBehaviour<TopBarUIActivator>.Instance.SetButtons(false);

            InterfaceController.Instance.Hide(GameWindow.ToolbarUI);

            GameplayScript gameplay = sessionScript.CreateGameAndStart(player, selectedRuleset);
            BoardCreationScript boardCreationScript = gameplay.GetComponent<BoardCreationScript>();
            GridLabelManager gridLabelManager = boardCreationScript.gameObject.GetComponent<GridLabelManager>();

            boardCreationScript.BlockAllCells();

            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_1, true, true, 0, true);

            ftueController.SendFtueProgress("Game1TheGoal_1");

            overlayUISceneActivator.SubscribeForFullScreenTap(() =>
            {
                ftueController.SendFtueProgress("FiveAdjacent_2");
                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_2, true);

                gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 1 }, new List<int> { });
                gridLabelManager.ShowFtueArrows(new List<int> { 6 });

                boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_2);
                SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(true, GameConstants.Ftue.FirstGame.HandAnimations.Hand1_2);

                boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_2);
                ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_2, () =>
                {
                    SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(false);
                    overlayUISceneActivator.HideFtueMessages();

                }, () =>
                {
                    ftueController.SendFtueProgress("FiveTiles_3");
                    overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_3, true);

                    boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_3);

                    gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 1 }, new List<int> { 2 });
                    gridLabelManager.ShowFtueArrows(new List<int> { 2 });

                    SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(true, GameConstants.Ftue.FirstGame.HandAnimations.Hand1_3);

                    boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_3);
                    ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_3, () =>
                    {
                        SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(false);
                        overlayUISceneActivator.HideFtueMessages();
                    }, () =>
                    {
                        ftueController.SendFtueProgress("FoundSingle_4");
                        overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_4, true, true, 0, true);

                        gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 1, 4 }, new List<int> { 2 });
                        gridLabelManager.ShowFtueArrows(new List<int> { 9 });

                        boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_4);

                        overlayUISceneActivator.SubscribeForFullScreenTap(() =>
                        {
                            ftueController.SendFtueProgress("BigNumbers_5");
                            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_5, true);

                            gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 1, 2, 3, 4 }, new List<int> { 0, 2, 4 });
                            gridLabelManager.ShowFtueArrows(new List<int> { 7, 8 });

                            SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(true, GameConstants.Ftue.FirstGame.HandAnimations.Hand1_5);

                            boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_5);

                            boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_5);

                            ftueController.ListenForFirstSpecificSelection(gameplay, new List<Vector2> { new Vector2(3, 1), new Vector2(3, 2), new Vector2(3, 4), new Vector2(3, 5) }, () =>
                            {
                                gridLabelManager.HideSpecificFtueArrow(7);
                            });

                            ftueController.ListenForSecondSpecificSelection(gameplay, new List<Vector2> { new Vector2(4, 1), new Vector2(4, 2), new Vector2(4, 4), new Vector2(4, 5) }, () =>
                            {
                                gridLabelManager.HideSpecificFtueArrow(8);
                            });

                            ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_5, () =>
                            {
                                overlayUISceneActivator.HideFtueMessages();
                                SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(false);
                            }, () =>
                            {
                                ftueController.SendFtueProgress("OneTileSo_6");
                                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_6, true, true, 0, true);

                                boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_6);
                                gridLabelManager.ShowFtueArrows(new List<int> { 9 });

                                overlayUISceneActivator.SubscribeForFullScreenTap(() =>
                                {
                                    ftueController.SendFtueProgress("FourAdjacent_7");
                                    overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_7, true);

                                    boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_7);

                                    gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 1, 2, 3, 4 }, new List<int> { 0, 1, 2, 4 });
                                    gridLabelManager.ShowFtueArrows(new List<int> { 1 });

                                    SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(true, GameConstants.Ftue.FirstGame.HandAnimations.Hand1_7);

                                    boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_7);
                                    ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_7, () =>
                                    {
                                        overlayUISceneActivator.HideFtueMessages();
                                        SceneActivationBehaviour<OverlayUISceneActivator>.Instance.ShowHandAnimation(false);
                                    }, () =>
                                    {
                                        ftueController.SendFtueProgress("CanYouFind_8");
                                        overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FirstGame.FtueMessages.Instructions1_8, true);

                                        gridLabelManager.ShowSpecificGridLabelsOnFtue(new List<int> { 0, 1, 2, 3, 4 }, new List<int> { 0, 1, 2, 3, 4 });
                                        gridLabelManager.ShowFtueArrows(new List<int> { 3 });

                                        boardCreationScript.HighlightCells(true, GameConstants.Ftue.FirstGame.DimAnimations.Dim1_8);

                                        boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_8, false);
                                        ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FirstGame.TargetCellVectors.TargetCells1_8, () =>
                                        {
                                            overlayUISceneActivator.HideFtueMessages();
                                            boardCreationScript.HighlightCells(false);
                                        }, () =>
                                        {
                                            overlayUISceneActivator.ftueMessagesPerStage = 0;
                                            gameplay.StartDelayedSession();

                                            gameplay.OnPuzzleSolved += gameData =>
                                            {
                                                overlayUISceneActivator.HideFtueMessages();

                                                int i = int.Parse(gameData.Ruleset.Id);
                                                ftueController.ProceedToGameOverAward(player, i);

                                                ftueController.SendFtueProgress("Game1Complete_9");
                                            };
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }
 private void Awake()
 {
     cellSelectionScript = transform.parent.parent.gameObject.GetComponent <CellSelectionScript>();
     gameplayScript      = transform.parent.parent.parent.gameObject.GetComponent <GameplayScript>();
     animator            = GetComponent <Animator>();
 }
        public void StartGame(Player player,
                              RuleSettings selectedRuleset,
                              FtueController ftueController,
                              SessionScript sessionScript,
                              OverlayUISceneActivator overlayUISceneActivator)
        {
            print("[FTUE] Second ftue game started ");

            InterfaceController.Instance.Show(GameWindow.OverlayUIScene);
            InterfaceController.Instance.Hide(GameWindow.MainMenu);

            SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(false);

            InterfaceController.Instance.Hide(GameWindow.ToolbarUI);

            GameplayScript      gameplay            = sessionScript.CreateGameAndStart(player, selectedRuleset);
            BoardCreationScript boardCreationScript = gameplay.GetComponent <BoardCreationScript>();
            GridLabelManager    gridLabelManager    = boardCreationScript.gameObject.GetComponent <GridLabelManager>();

            boardCreationScript.BlockAllCells();

            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_0, true, true, 0, true);

            ftueController.SendFtueProgress("Game2LetsFind_10");

            overlayUISceneActivator.SubscribeForFullScreenTap(() =>
            {
                ftueController.SendFtueProgress("RememberBig_11");
                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_1, true);

                gridLabelManager.ShowFtueArrows(new List <int> {
                    6
                });
                gridLabelManager.ShowSpecificGridLabelsOnFtue(new List <int> {
                    1
                }, new List <int> {
                });

                boardCreationScript.HighlightCells(true, GameConstants.Ftue.SecondGame.DimAnimations.Dim2_1);

                boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_1);
                ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_1, () =>
                {
                    overlayUISceneActivator.HideFtueMessages();
                }, () =>
                {
                    ftueController.SendFtueProgress("GreatKeepGoing_12");
                    overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_2, true);

                    gridLabelManager.ShowFtueArrows(new List <int> {
                        1, 3
                    });
                    gridLabelManager.ShowSpecificGridLabelsOnFtue(new List <int> {
                        1
                    }, new List <int> {
                        1, 3
                    });

                    boardCreationScript.HighlightCells(true, GameConstants.Ftue.SecondGame.DimAnimations.Dim2_2);

                    boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_2);

                    ftueController.ListenForFirstSpecificSelection(gameplay, new List <Vector2> {
                        new Vector2(1, 2), new Vector2(3, 2), new Vector2(4, 2), new Vector2(5, 2)
                    }, () =>
                    {
                        gridLabelManager.HideSpecificFtueArrow(1);
                    });

                    ftueController.ListenForSecondSpecificSelection(gameplay, new List <Vector2> {
                        new Vector2(1, 4), new Vector2(3, 4), new Vector2(4, 4), new Vector2(5, 4)
                    }, () =>
                    {
                        gridLabelManager.HideSpecificFtueArrow(3);
                    });

                    ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_2, () =>
                    {
                        overlayUISceneActivator.HideFtueMessages();
                    }, () =>
                    {
                        ftueController.SendFtueProgress("TwoAndTwo_13");
                        overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_3, true);

                        gridLabelManager.ShowFtueArrows(new List <int> {
                            5
                        });
                        gridLabelManager.ShowSpecificGridLabelsOnFtue(new List <int> {
                            0, 1
                        }, new List <int> {
                            0, 1, 3, 4
                        });

                        boardCreationScript.HighlightCells(true, GameConstants.Ftue.SecondGame.DimAnimations.Dim2_3);

                        boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_3);
                        ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_3, () =>
                        {
                            overlayUISceneActivator.HideFtueMessages();
                        }, () =>
                        {
                            ftueController.SendFtueProgress("GroupThree_14");
                            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_4, true);

                            gridLabelManager.ShowFtueArrows(new List <int> {
                                7
                            });
                            gridLabelManager.ShowSpecificGridLabelsOnFtue(new List <int> {
                                0, 1, 2
                            }, new List <int> {
                                0, 1, 3, 4
                            });

                            boardCreationScript.HighlightCells(true, GameConstants.Ftue.SecondGame.DimAnimations.Dim2_4);

                            boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_4);
                            ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_4, () =>
                            {
                                overlayUISceneActivator.HideFtueMessages();
                            }, () =>
                            {
                                ftueController.SendFtueProgress("ThreeAdjacents_15");
                                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SecondGame.FtueMessages.Instructions2_5, true);

                                gridLabelManager.ShowFtueArrows(new List <int> {
                                    8, 9
                                });
                                gridLabelManager.ShowSpecificGridLabelsOnFtue(new List <int> {
                                    0, 1, 2, 3, 4
                                }, new List <int> {
                                    0, 1, 2, 3, 4
                                });

                                boardCreationScript.HighlightCells(true, GameConstants.Ftue.SecondGame.DimAnimations.Dim2_5);

                                ftueController.ListenForFirstSpecificSelection(gameplay, new List <Vector2> {
                                    new Vector2(4, 3)
                                }, () =>
                                {
                                    gridLabelManager.HideSpecificFtueArrow(8);
                                });

                                ftueController.ListenForSecondSpecificSelection(gameplay, new List <Vector2> {
                                    new Vector2(5, 3)
                                }, () =>
                                {
                                    gridLabelManager.HideSpecificFtueArrow(9);
                                });

                                boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_5, false);
                                ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.SecondGame.TargetCellVectors.TargetCells2_5, () =>
                                {
                                    overlayUISceneActivator.HideFtueMessages();
                                }, () =>
                                {
                                    boardCreationScript.HighlightCells(false);

                                    overlayUISceneActivator.ftueMessagesPerStage = 0;
                                    gameplay.StartDelayedSession();

                                    gameplay.OnPuzzleSolved += gameData =>
                                    {
                                        overlayUISceneActivator.HideFtueMessages();

                                        int i = int.Parse(gameData.Ruleset.Id);
                                        ftueController.ProceedToGameOverAward(player, i);

                                        ftueController.SendFtueProgress("Game2Complete_16");
                                    };
                                });
                            });
                        });
                    });
                });
            });
        }
 void Start()
 {
     a_Verifier.Init(m_Rigidbody2D, chosenAbility);
     GameplayScript.SetHpUI(health);
 }
 private void GetDependencies()
 {
     gameplayScript    = GameObject.FindObjectOfType <GameplayScript>();
     timerScript       = GameObject.FindObjectOfType <TimerScript>();
     fieldLabelsScript = GameObject.FindObjectOfType <FieldLabelsScript>();
 }
 private void Start()
 {
     gps = GameObject.Find("GameManager").GetComponent <GameplayScript>();
 }
 void Start() {
     gameplayScript = GameObject.Find("Gameplay").GetComponent<GameplayScript>();
 }
Beispiel #30
0
 private void Awake()
 {
     selector = true;
     gps      = GameObject.Find("GameManager").GetComponent <GameplayScript>();
 }
Beispiel #31
0
 void Start()
 {
     rigidbody       = GetComponent <Rigidbody2D>();
     gameplayScript  = GetComponent <GameplayScript>();
     enemyBlasterRef = Resources.Load("EnemyBlaster");
 }
Beispiel #32
0
        public void StartGame(Player player, RuleSettings selectedRuleset, FtueController ftueController, SessionScript sessionScript, OverlayUISceneActivator overlayUISceneActivator, bool shouldShowHintTip)
        {
            print("[FTUE] Sixth ftue game started ");

            InterfaceController.Instance.Hide(GameWindow.MainMenu);
            GameplayScript      gameplay            = sessionScript.CreateGameAndStart(player, selectedRuleset);
            BoardCreationScript boardCreationScript = gameplay.GetComponent <BoardCreationScript>();

            InterfaceController.Instance.Show(GameWindow.ToolbarUI);

            if (shouldShowHintTip)
            {
                SceneActivationBehaviour <ToolbarUIActivator> .Instance.HintButtonScript.FtueForceHintOn();

                InterfaceController.Instance.Show(GameWindow.OverlayUIScene);
                SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(false);

                boardCreationScript.BlockAllCells();

                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SixthGame.FtueMessages.Instructions6_1, true, false, 0, false, 1, false);

                SceneActivationBehaviour <ToolbarUIActivator> .Instance.ShowHandAnimation(true, GameConstants.Ftue.SixthGame.HandAnimations.Hand6_1);

                ftueController.SendFtueProgress("Game6UseHint_42");

                overlayUISceneActivator.SubscribeHintTap(() =>
                {
                    ftueController.SendFtueProgress("CantUndo_43");
                    overlayUISceneActivator.HideFtueMessages();

                    SceneActivationBehaviour <ToolbarUIActivator> .Instance.ShowHandAnimation(false);
                    SceneActivationBehaviour <ToolbarUIActivator> .Instance.ForceHintFtue(new Vector2(4, 2));

                    StartCoroutine(WaitForHintAnimation(() =>
                    {
                        overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.SixthGame.FtueMessages.Instructions6_2, true, true, 0, true, 0, false);

                        overlayUISceneActivator.SubscribeForFullScreenTap(() =>
                        {
                            ftueController.PersistHintTipUse(player);

                            overlayUISceneActivator.ftueMessagesPerStage = 0;
                            gameplay.StartDelayedSession(true);

                            boardCreationScript.UnblockAllCells();

                            overlayUISceneActivator.HideFtueMessages();

                            gameplay.OnPuzzleSolved += gameData =>
                            {
                                int i = int.Parse(gameData.Ruleset.Id);
                                ftueController.ProceedToGameOverAward(player, i);

                                ftueController.SendFtueProgress("Game6Complete_44");
                            };
                        });
                    }));
                });
            }
            else
            {
                SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(false);

                overlayUISceneActivator.ftueMessagesPerStage = 0;
                gameplay.StartDelayedSession(true);
                boardCreationScript.UnblockAllCells();

                gameplay.OnPuzzleSolved += gameData =>
                {
                    int i = int.Parse(gameData.Ruleset.Id);
                    ftueController.ProceedToGameOverAward(player, i);

                    ftueController.SendFtueProgress("Game6Complete_44");
                };
            }
        }
        public void StartGame(Player player,
                              RuleSettings selectedRuleset,
                              FtueController ftueController,
                              SessionScript sessionScript,
                              OverlayUISceneActivator overlayUISceneActivator)
        {
            print("[FTUE] Fifth ftue game started ");

            InterfaceController.Instance.Show(GameWindow.OverlayUIScene);
            InterfaceController.Instance.Hide(GameWindow.MainMenu);

            SceneActivationBehaviour <TopBarUIActivator> .Instance.SetButtons(false);

            GameplayScript      gameplay            = sessionScript.CreateGameAndStart(player, selectedRuleset);
            BoardCreationScript boardCreationScript = gameplay.GetComponent <BoardCreationScript>();
            GridLabelManager    gridLabelManager    = boardCreationScript.gameObject.GetComponent <GridLabelManager>();

            InterfaceController.Instance.Show(GameWindow.ToolbarUI);
            SceneActivationBehaviour <ToolbarUIActivator> .Instance.ToolToggle.interactable = false;

            boardCreationScript.BlockAllCells();

            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_1, true, true, 0, true);

            ftueController.SendFtueProgress("Game5CantTell_31");

            boardCreationScript.HighlightCells(true, GameConstants.Ftue.FifthGame.HighlightCellAnimations.HighlightCells5_1);

            overlayUISceneActivator.SubscribeForFullScreenTap(() =>
            {
                ftueController.SendFtueProgress("ThreeCorrect_32");
                overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_2, true);

                boardCreationScript.HighlightCells(false);

                boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_2);

                ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_2, () =>
                {
                    overlayUISceneActivator.HideFtueMessages();
                }, () =>
                {
                    ftueController.SendFtueProgress("LetsFillThese_33");
                    overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_3, true);

                    boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_3);

                    ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_3, () =>
                    {
                        overlayUISceneActivator.HideFtueMessages();
                    }, () =>
                    {
                        ftueController.SendFtueProgress("FillMore_34");
                        boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_4);

                        ftueController.ListenForCurrentFtueCellSelection(gameplay, GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_4, () =>
                        {
                            //
                        }, () =>
                        {
                            ftueController.SendFtueProgress("XTool_35");

                            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_5, true);

                            SceneActivationBehaviour <ToolbarUIActivator> .Instance.ShowHandAnimation(true, GameConstants.Ftue.FifthGame.HandAnimations.Hand5_5);

                            overlayUISceneActivator.SubscribeForToolToggleTap(() =>
                            {
                                SceneActivationBehaviour <ToolbarUIActivator> .Instance.ShowHandAnimation(false);
                                SceneActivationBehaviour <ToolbarUIActivator> .Instance.ToggleToCross();
                                ftueController.SendFtueProgress("LetsCrossRow_36");

                                StartCoroutine(ShortWait(() => overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_6, true)));

                                boardCreationScript.HighlightCells(true);
                                gridLabelManager.ShowFtueArrows(new List <int> {
                                    5
                                });

                                boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_6);
                                ftueController.ListenForCurrentFtueCellMarking(gameplay, GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_6, () =>
                                {
                                    ftueController.SendFtueProgress("CoolFewMore_37");
                                    overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_7, true);

                                    gridLabelManager.ShowFtueArrows(new List <int> {
                                        0, 4
                                    });

                                    boardCreationScript.BlockCellsToBeSelected(GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_7);

                                    ftueController.ListenForFirstSpecificMarking(gameplay, () =>
                                    {
                                        gridLabelManager.HideSpecificFtueArrow(0);
                                    });

                                    ftueController.ListenForSecondSpecificMarking(gameplay, () =>
                                    {
                                        gridLabelManager.HideSpecificFtueArrow(4);
                                    });

                                    ftueController.ListenForCurrentFtueCellMarking(gameplay, GameConstants.Ftue.FifthGame.TargetCellVectors.TargetCells5_7, () =>
                                    {
                                        ftueController.SendFtueProgress("RememberTilesNot_38");
                                        overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_8, true, true, 0, true);
                                        boardCreationScript.HighlightCells(false);

                                        overlayUISceneActivator.SubscribeForFullScreenTap(() =>
                                        {
                                            ftueController.SendFtueProgress("SelectMarker_39");
                                            overlayUISceneActivator.ShowFtueGameplayMessage(GameConstants.Ftue.FifthGame.FtueMessages.Instructions5_9, true);
                                            boardCreationScript.HighlightCells(false);

                                            // paint tap animation
                                            SceneActivationBehaviour <ToolbarUIActivator> .Instance.ShowHandAnimation(true, GameConstants.Ftue.FifthGame.HandAnimations.Hand5_9);

                                            overlayUISceneActivator.SubscribeForToolToggleTap(() =>
                                            {
                                                ftueController.SendFtueProgress("StartGame5_40");

                                                SceneActivationBehaviour <ToolbarUIActivator> .Instance.GameFiveToolToggleTap();

                                                overlayUISceneActivator.HideFtueMessages();
                                                overlayUISceneActivator.ftueMessagesPerStage = 0;

                                                gameplay.StartDelayedSession(true);
                                                boardCreationScript.UnblockAllCells();

                                                gameplay.OnPuzzleSolved += gameData =>
                                                {
                                                    int i = int.Parse(gameData.Ruleset.Id);
                                                    ftueController.ProceedToGameOverAward(player, i);

                                                    ftueController.SendFtueProgress("Game5Complete_41");
                                                };
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }