コード例 #1
0
    public GamePLay(int gameMap, Match myMatch)
    {
        this.myMatch = myMatch;
        if (myMatch.matchType == MatchType.Tutorial)
        {
            currentTutorialPlayer = myMatch.currentPlayer;
            currentPlayerStage    = TutorialStage.Introduction;
            ServerSend.BeginTutorial(currentTutorialPlayer.GetPlayerId());
        }
        else
        {
            this.gameMap = (Map)gameMap;
            foreach (var player in myMatch.GetTeam1())
            {
                team1Zones.Add(player.GetPlayerId(), -1);
                gamePlayers.Add(new InternalPlayerMethods(1, player.GetPlayerId(), this.myMatch.MatchLobby.currentPick[player.GetPlayerId()], this));
            }
            foreach (var player in myMatch.GetTeam2())
            {
                team2Zones.Add(player.GetPlayerId(), -1);
                gamePlayers.Add(new InternalPlayerMethods(2, player.GetPlayerId(), this.myMatch.MatchLobby.currentPick[player.GetPlayerId()], this));
            }

            UpdateGamePlay     += UpdateMethod;
            FastUpdateGamePlay += FastUpdateMethod;
        }
    }
コード例 #2
0
    void Start()
    {
        stage = TutorialStage.Objective;


        objectiveScreen     = transform.Find("GameObjective").gameObject;
        buildControlScreen  = transform.Find("BuildControls").gameObject;
        battleControlScreen = transform.Find("BattleControls").gameObject;

        team1Rocket = GameObject.Find("Team1Base").gameObject;
        team2Rocket = GameObject.Find("Team2Base").gameObject;

        scenery = GameObject.Find("Scenery").gameObject;

        pressStart = GameObject.Find("PressStart");
        pressStart.SetActive(false);
        buildSpotUI = GameObject.Find("BuildSpotUI");
        buildSpotUI.SetActive(false);
        battleSpotUI = GameObject.Find("BattleSpotUI");
        battleSpotUI.SetActive(false);

        team1BlocksToGo               = GameObject.Find("Team1BlocksToGo").gameObject.GetComponent <Text>();
        team2BlocksToGo               = GameObject.Find("Team2BlocksToGo").gameObject.GetComponent <Text>();
        nasaCountdownAudioSource      = gameObject.AddComponent <AudioSource>();
        nasaCountdownAudioSource.clip = countdownSFX;
        nasaCountdownAudioSource.time = 7.5f; // play the countdown at exactly the "3, 2, 1...liftoff" part

        players     = new GameObject[4];
        players [0] = GameObject.Find("Players").transform.Find("Player1").gameObject;
        players [1] = GameObject.Find("Players").transform.Find("Player2").gameObject;
        players [2] = GameObject.Find("Players").transform.Find("Player3").gameObject;
        players [3] = GameObject.Find("Players").transform.Find("Player4").gameObject;

        tutorialMap = new Dictionary <TutorialStage, Action> ();
        tutorialMap.Add(TutorialStage.Objective, InitBuildControls);
        tutorialMap.Add(TutorialStage.BuildControls, InitCountdown);
        tutorialMap.Add(TutorialStage.Countdown, InitBattleControls);
        tutorialMap.Add(TutorialStage.BattleControls, FinishTutorial);

        advanceToNextStageMap = new Dictionary <TutorialStage, Action> ();
        advanceToNextStageMap.Add(TutorialStage.Objective, GenericAdvanceCondition);
        advanceToNextStageMap.Add(TutorialStage.BuildControls, BuildAdvanceCondition);
        advanceToNextStageMap.Add(TutorialStage.Countdown, CountdownAdvanceCondition);
        advanceToNextStageMap.Add(TutorialStage.BattleControls, GenericAdvanceCondition);


        inputDevices = new InputDevice[4];
        for (int i = 0; i < 4; ++i)
        {
            try {
                inputDevices[i] = InputManager.Devices [i];
            } catch {
                Debug.Log("4 controllers are not connected. Assigning extra players to first player");
                inputDevices[i] = InputManager.Devices [0];
            }
        }

        InitTutorial();
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        mStage = TutorialStage.START;
        mUI    = Utilities.GetUIManager();

        // Utilities.GetTimingManager().SetPaused(true);
        mUI.ShowMessage("This is a game about raising a tribe under a deity that demands human sacrifices.\n", this);
    }
コード例 #4
0
    void StartStage(TutorialStage stage)
    {
        voiceoverSource.Stop();
        voiceoverSource.clip = stage.voiceLine;
        voiceoverSource.Play();

        SetTargetLines(stage);
        stage.highlightMeshes();
    }
コード例 #5
0
 public void EnableTutorial()
 {
     if (!isTutorialEnabled)
     {
         isTutorialEnabled = true;
         currentStage      = TutorialStage.WaitingForStart;
         StartNextStep();
     }
 }
コード例 #6
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            drawBatch   = new DrawBatch(GraphicsDevice);

            this.appResources = new AppResources(GraphicsDevice, Content, spriteBatch, drawBatch);

            stage = new TutorialStage(appResources);
            stage.LoadContent();
        }
コード例 #7
0
    private void Start()
    {
        tutorialStage           = TutorialStage.PressKey;
        _pressKeyTutorialChilds = new GameObject[pressKey.transform.childCount];
        _uiTutorialChilds       = new GameObject[UI.transform.childCount];
        _gamePlayTutorialChilds = new GameObject[gamePlay.transform.childCount];
        AddToArray(pressKey, _pressKeyTutorialChilds);
        AddToArray(UI, _uiTutorialChilds);
        AddToArray(gamePlay, _gamePlayTutorialChilds);

        EnableTutorialItems();
    }
コード例 #8
0
    /******************** Switch Screen Functions ********************/

    public void InitTutorial()
    {
        objectiveScreen.SetActive(true);
        buildControlScreen.SetActive(false);
        battleControlScreen.SetActive(false);
        SetRocketsActive(false);
        scenery.SetActive(false);
        TurnOffPlayers();

        stage = TutorialStage.Objective;

        canSkip = true;
    }
コード例 #9
0
    public void InitCountdown()
    {
        CancelInvoke();
        GameObject.Find("Team1BlocksToBuild").gameObject.GetComponent <Text>().text = "";
        GameObject.Find("Team2BlocksToBuild").gameObject.GetComponent <Text>().text = "";
        team1BlocksToGo.gameObject.SetActive(true);
        team2BlocksToGo.gameObject.SetActive(true);
        pressStart.SetActive(false);
        stage = TutorialStage.Countdown;
        nasaCountdownAudioSource.Play();

        canSkip = false;
    }
コード例 #10
0
 private void Start()
 {
     try
     {
         goalText = FindObjectOfType <GoalText>().GetComponent <GoalText>();
         tutorial = FindObjectOfType <TutorialStage>().GetComponent <TutorialStage>();
     }
     catch (Exception e)
     {
         //Avoid crash
     }
     //Debug data remove
     //PlayerPrefs.DeleteAll();
 }
コード例 #11
0
    public void InitBuildControls()
    {
        scenery.SetActive(true);
        shouldAdvanceToNextStage = false;
        objectiveScreen.SetActive(false);
        buildControlScreen.SetActive(true);
        SetRocketsActive(true);
        TurnOnPlayers();

        stage = TutorialStage.BuildControls;

        Invoke("HighlightBlocks", 1.5f);

        canSkip = false;
    }
コード例 #12
0
    public void DisableTutorial()
    {
        isTutorialEnabled = false;
        swipeTutorial.DisableTutorial();
        zoomTutorial.DisableTutorial();
        tappingTutorial.DisableTutorial();
        doubleTapTutorial.DisableTutorial();
        rotationTutorial.DisableTutorial();
        pertitedAction.Clear();
        var but = planetInfoScreen?.Q("solve-button");

        but.style.backgroundImage = Resources.Load("UI/Buttons/SolveButton") as Texture2D;
        but.SetEnabled(true);
        currentStage = TutorialStage.WaitingForStart;
    }
コード例 #13
0
    public void InitBattleControls()
    {
        buildControlScreen.SetActive(false);
        battleControlScreen.SetActive(true);
        pressStart.SetActive(false);
        TurnOnPlayers();

        PhaseManager.S.SwitchToBattlePhase();
        stage     = TutorialStage.BattleControls;
        startTime = Time.time;
        Invoke("ClearBattleText", DELAY_TIME);
        Invoke("HighlightCockpit", 3f);

        canSkip = false;
    }
コード例 #14
0
 private void setupTogglingToAttackStage()
 {
     currentStage                       = TutorialStage.TogglingToAttack;
     isTextShowing                      = true;
     isMovementEnabled                  = false;
     isBeatEnabled                      = false;
     isAttackTogglingEnabled            = true;
     isComboEnabled                     = false;
     directionChecklist                 = new bool[4];
     attackDirectionChecklist           = new bool[4];
     isAttackTogglingObjectiveCompleted = false;
     isComboObjectiveCompleted          = false;
     isSpecial = false;
     Debug.Log("Entering toggling to attack stage");
 }
コード例 #15
0
    void SetTargetLines(TutorialStage stage)
    {
        leftHandLine.setRender(false);
        if (stage.leftHandTarget != null)
        {
            leftHandLine.setRender(true);
            leftHandLine.target = stage.leftHandTarget;
        }

        rightHandLine.setRender(false);
        if (stage.rightHandTarget != null)
        {
            rightHandLine.setRender(true);
            rightHandLine.target = stage.rightHandTarget;
        }
    }
コード例 #16
0
 void ChooseInput(TutorialStage nextStage)
 {
     if (touchDirection.magnitude > 100)
     {
         var   normTouchDirection = touchDirection.normalized;
         float absoluteDirection  = Mathf.Abs(Vector2.Dot(normTouchDirection, Vector2.right));
         if (absoluteDirection > .7)
         {
             if (normTouchDirection.x > .7)
             {
                 touchDirection = new Vector2();
                 currentStage   = nextStage;
                 narration.Stop();
                 narration.time = 0.0f;
             }
         }
     }
 }
コード例 #17
0
    void MoveOnTutorialStage()
    {
        switch (tutorialStage)
        {
        case TutorialStage.PressKey:
            tutorialStage = TutorialStage.UI;
            pressNKey.SetActive(true);
            break;

        case TutorialStage.UI:
            tutorialStage = TutorialStage.GamePlay;
            break;

        case TutorialStage.GamePlay:
            tutorialStage = TutorialStage.Finished;
            pressNKey.SetActive(false);
            break;
        }
    }
コード例 #18
0
ファイル: Tutorial.cs プロジェクト: Chad307/VR-Exercise-Game
        public void SwitchStages(TutorialStage newStage)
        {
            tutorialStage = newStage;
            stageIndex    = 0;

            switch (tutorialStage)
            {
            case TutorialStage.Menus:
                currTexts   = menuTexts;
                currClips   = menuClips;
                currButtons = menuButtons;
                break;

            case TutorialStage.Gameplay:
                currTexts   = gameTexts;
                currClips   = gameClips;
                currButtons = gameButtons;
                break;
            }
        }
コード例 #19
0
ファイル: TutorialScript.cs プロジェクト: BasicLich/SkyTD
    public override void _Process(float delta)
    {
        base._Process(delta);
        if (this.CurrentStage == TutorialStage.IntroFade)
        {
            this.game._camera.Position = new Vector2(0, 0);
            this.game._camera.Zoom     = Vector2.One * 0.25f;
            if ((this._tutorialTimer += delta) > 3)
            {
                this.CurrentStage = TutorialStage.FirstChat;
                this.game.isFadeTutorialLocked = false;
                this.rtl.AppendBbcode(this.lines[0]);
                this.dialogContainer.Visible = true;
            }
            else
            {
                this.game.isFadeTutorialLocked = true;
                this.game._damageSplash.Color  = new Color(0, 0, 0, 1 - (this._tutorialTimer / 3f));
            }
        }

        if (!this.cameraDone)
        {
            this.cameraMovementTime += delta;
            float cmi  = (this.cameraMovementTime / this.cameraMovementTimeDesired);
            float cmtI = 1 - cmi;
            this.game._camera.Position = new Vector2(this.cameraStartPosition.x * cmtI + this.cameraDesiredPosition.x * cmi, this.cameraStartPosition.y * cmtI + this.cameraDesiredPosition.y * cmi);
            this.game._camera.Zoom     = new Vector2(this.cameraStartZoom.x * cmtI + this.cameraDesiredZoom.x * cmi, this.cameraStartZoom.y * cmtI + this.cameraDesiredZoom.y * cmi);
            if (this.cameraMovementTime >= this.cameraMovementTimeDesired)
            {
                this.cameraDone = true;
                if (this.CurrentStage == TutorialStage.End)
                {
                    this.game.isFadeTutorialLocked = this.game.isTutorial = this.game.isCameraTutorialLocked = this.game.isPlacementTutorialLocked = false;
                    this.dialogContainer.Visible   = false;
                    this.game.AdvanceWave();
                    this.QueueFree();
                }
            }
        }
    }
コード例 #20
0
    private void changePhase()
    {
        switch (stage)
        {
        case TutorialStage.EnemyHit:
            ChargePatternsTutorial();
            Invoke("SpawnTutorial", timePerBattery);
            break;

        case TutorialStage.NoObstacleHit:
            ChargePatternsTutorial();
            Invoke("SpawnTutorial", timePerBattery);
            break;

        case TutorialStage.ThirdPhase:
            actualPatternTutorial++;
            stage = TutorialManager.Instance.GetStage();
            EnemyTutorial();
            break;
        }
    }
コード例 #21
0
    //---------------------------------------------------------------------------------------------------------------
    /// <summary>
    ///  Returns true if tutorial popup associatered with stage was shown.
    /// </summary>
    /// <param name="stage"></param>
    /// <param name="stageType">independent stages doesn't change LastStage variable in Manager</param>
    /// <returns></returns>
    public bool ShowStage(TutorialId stage, TutorialStage stageType = TutorialStage.standard)
    {
        if (!this.IsActive)
        {
            return(false);
        }

        if (this.WasStageShown(stage))
        {
            // its okay not to show debug MSG, so these calxulations are made on manager side, not ingame code.
            // Debug.LogError("Tutorial Stage " + stage + " was requested, but this stage was shown already.");
            return(false);
        }

        if (stageType == TutorialStage.standard)
        {
            if ((int)stage < this.GetLastStage)
            {
                // its okay not to show debug MSG, so these calxulations are made on manager side, not ingame code.
                Debug.LogError(" Standard stage will index less to last stage was called. Check integrity of Tutorial.");
                return(false);
            }

            this.SetLastLoadedStage(stage);
        }

        Debug.Log("Tutorial stage " + stage + ".");
        this.MarkStageDone(stage);

        PopupId tutorialPopupID = this.GetPopID(stage);

        if (tutorialPopupID == PopupId.NoPopUp)
        {
            Debug.LogError("Can't find PopUp with id " + stage.GetDesc() + " for stage " + stage + " in PopUp ID enum.");
            return(false);
        }

        Game.UiManager.Open(tutorialPopupID);
        return(true);
    }
コード例 #22
0
        /// <summary>
        /// Prepares plugin for tutorial steps
        /// </summary>
        /// <param name="stage"></param>
        private void SetupStage(TutorialStage stage)
        {
            this.setupStage = stage;
            switch (stage)
            {
            case TutorialStage.ZoomIn:
                API.MapManager.ZoomInEvent += this.FinishZoomInTutorial;
                break;

            case TutorialStage.ZoomOut:
                API.MapManager.ZoomOutEvent += this.FinishZoomOutTutorial;
                break;

            case TutorialStage.OverlayMode:
                API.UiElements.ParentForm.ModeChanged += this.ParentModeChanged;
                break;

            case TutorialStage.OverlayTitlebarMenuOpen:
                API.UiElements.ParentForm.OverlayTitleContextMenuStrip.Opened += this.OverlayMenuOpenedFinalizer;
                break;

            case TutorialStage.OverlayTitlebarMenuClose:
                API.UiElements.ParentForm.OverlayTitleContextMenuStrip.Closed += this.OverlayMenuClosedFinalizer;
                break;

            case TutorialStage.OverlayResizeWindow:
                API.UiElements.ParentForm.Resize += OverlayResizeFinalizer;
                break;

            case TutorialStage.OverlayExit:
                API.UiElements.ParentForm.ModeChanged += this.ParentModeChanged;
                break;

            case TutorialStage.Magnification:
                API.UiElements.ParentForm.MagnificationChange += MagnificationFinalizer;
                break;
            }
        }
コード例 #23
0
ファイル: TutorialScript.cs プロジェクト: BasicLich/SkyTD
    public override void _Input(InputEvent @event)
    {
        if (@event is InputEventMouseButton btn && @event.IsPressed() && btn.ButtonIndex == (int)ButtonList.Left)
        {
            if (this.CurrentStage == TutorialStage.FirstChat)
            {
                this.game.Sounds[SoundName.DialogSkip].Play();
                ++this.cLineIndex;
                if (this.cLineIndex == 7)
                {
                    this.cameraMovementTime        = 0;
                    this.cameraMovementTimeDesired = 1;
                    this.cameraDesiredPosition     = new Vector2(200, 260);
                    this.cameraStartPosition       = this.game._camera.Position;
                    this.cameraDesiredZoom         = this.game._camera.Zoom;
                    this.cameraStartZoom           = this.game._camera.Zoom;
                    this.cameraDone = false;
                }

                if (this.cLineIndex >= this.lines.Length)
                {
                    this.CurrentStage              = TutorialStage.End;
                    this.cameraMovementTime        = 0;
                    this.cameraMovementTimeDesired = 1;
                    this.cameraDesiredPosition     = new Vector2(0, 0);
                    this.cameraStartPosition       = this.game._camera.Position;
                    this.cameraDesiredZoom         = new Vector2(0.9f, 0.9f);
                    this.cameraStartZoom           = this.game._camera.Zoom;
                    this.cameraDone = false;
                    return;
                }

                this.rtl.BbcodeText = string.Empty;
                this.rtl.AppendBbcode(this.lines[this.cLineIndex]);
            }
        }
    }
コード例 #24
0
    private void AdvanceTutorial()
    {
        // TODO: can this be coroutine'd?
        mStage = mStage + 1;

        switch (mStage)
        {
        case TutorialStage.INTRO:
            Debug.Log("me: " + transform.name);
            ShowHighlight("PeopleHighlight", true);
            mUI.ShowMessage("The left side of the screen shows the people in your tribe.", this);
            break;

        case TutorialStage.FARMER_INFO:
            ShowHighlight("PeopleHighlight", false);
            ShowHighlight("FoodHighlight", true);
            mUI.ShowMessage("Right now, both of your people are farmers. They are providing food for your tribe.", this);
            break;

        case TutorialStage.CHANGE_TO_WARRIOR:
            mUI.ShowMessage("You can change a person's profession by dragging them to another area on the left.\n" +
                            "Change one of them to be a warrior.", this);
            break;

        case TutorialStage.FOOD_INFO:
            mUI.ShowMessage("Now that you only have one farmer, your food production has dropped.", this);
            break;

        case TutorialStage.FOOD_INFO_2:
            mUI.ShowMessage("Each person in your tribe requires 1 food, so you are still producing enough.", this);
            break;

        case TutorialStage.SACRIFICE_INFO:
            ShowHighlight("Demands", true);
            mUI.ShowMessage("You will need to sacrifice people from your tribe to satisfy your god's demands.", this);
            break;

        case TutorialStage.SACRIFICE_INFO_2:
            mUI.ShowMessage("Your god is demanding that you sacrifice a warrior.\n" +
                            "Drag your warrior from the left over to the sacrifice on the right.", this);
            break;

        case TutorialStage.HEALTH_INFO:
            // maybe there's no reason to do this so soon?
            transform.Find("LifeforceHighlight").gameObject.SetActive(true);
            mUI.ShowMessage("This is a person's lifeforce. If it reaches 0, they die.\n", this);
            break;

        case TutorialStage.PROFESSION_INFO:
            transform.Find("LifeforceHighlight").gameObject.SetActive(false);
            transform.Find("ProfessionHighlight").gameObject.SetActive(true);
            mUI.ShowMessage("This is a person's profession. Different professions provide different benefits to your tribe.", this);
            break;

        case TutorialStage.CIVILIAN_INFO:
            mUI.ShowMessage("Increasing your population is important. Be sure to always have at least one civilian, or your tribe will stagnate.", this);
            break;

        case TutorialStage.PAUSE_BUTTON:
            mUI.ShowMessage("You can pause and unpause the game with this button. Right now the game is paused. Click it to unpause.", this);
            break;
        }
    }
コード例 #25
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            Config.InvertMouseY = !Config.InvertMouseY;
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        GameObject LookedAtObject = null;
        RaycastHit hit;

        if (Physics.Raycast(CamTransform.position, CamTransform.forward, out hit, InteractionDistance))
        {
            LookedAtObject = hit.collider.attachedRigidbody != null ? hit.collider.attachedRigidbody.gameObject : hit.collider.gameObject;
        }

        // Camera control
        Vector2 MouseLook = Config.GetMouseLook();

        Pitch = Mathf.Clamp(Pitch + MouseLook.y, -89f, 89f);
        Vector3 NewEulers = CamTransform.localEulerAngles;

        NewEulers.x  = Pitch;
        NewEulers.y += MouseLook.x;
        CamTransform.localEulerAngles = NewEulers;

        // Character movement
        Vector3 Move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

        Move                   = CamTransform.TransformDirection(Move);
        Move.y                 = 0;
        Move                   = Move.normalized * MovementSpeed * (Input.GetButton("Sprint") ? SprintingMultiplier : 1);
        CamBobber.Bob          = Move.magnitude > 0.05;
        CamBobber.BobFrequency = 2 * (Input.GetButton("Sprint") ? SprintingMultiplier : 1);
        if (CharacterController.isGrounded)
        {
            if (Input.GetButtonDown("Jump"))
            {
                VelocityY = JumpForce;
            }
            else
            {
                VelocityY = 0;
            }
        }
        else
        {
            VelocityY += Physics.gravity.y * Time.deltaTime;
        }
        Move.y = VelocityY;
        CharacterController.Move(Move * Time.deltaTime);

        // Pickups
        // The "pick up" action
        if (Input.GetButtonDown("Pick Up / Drop Item"))
        {
            if (LookedAtObject != null && LookedAtObject.GetComponent(typeof(IInteractable)) != null)
            {
                IInteractable Interactable = (IInteractable)LookedAtObject.GetComponent(typeof(IInteractable));
                Interactable.Interact(CurrentlyPickedUpObject != null ? CurrentlyPickedUpObject.gameObject : null);
            }
            else
            {
                if (CurrentlyPickedUpObject != null)
                {
                    int Index = Inventory.IndexOf(CurrentlyPickedUpObject.gameObject);
                    if (CurrentInventorySelectionIndex >= Index && CurrentInventorySelectionIndex > 0)
                    {
                        CurrentInventorySelectionIndex--;
                    }
                    Inventory.RemoveAt(Index);
                    if (LookedAtObject != null)
                    {
                        CurrentlyPickedUpObject.PutDown(hit.point, -hit.normal);
                        CurrentlyPickedUpObject = null;
                    }
                    else
                    {
                        CurrentlyPickedUpObject.ThrowDown();
                        CurrentlyPickedUpObject = null;
                    }
                }
                else
                {
                    if (LookedAtObject != null)
                    {
                        Pickup Target = LookedAtObject.GetComponent <Pickup>();
                        if (Target != null)
                        {
                            ItemSounds Sfx = LookedAtObject.GetComponent <ItemSounds>();
                            if (Sfx != null)
                            {
                                Sfx.Open();
                            }
                            Target.PickUp(PickupTarget);
                            CurrentlyPickedUpObject = Target;
                            Inventory.Add(Target.gameObject);
                            CurrentInventorySelectionIndex = Inventory.Count - 1;
                            if (CurrentTutorialStage == TutorialStage.Pickup)
                            {
                                CurrentTutorialStage = TutorialStage.PostInventory0;
                            }
                            Examinable Examinable = CurrentlyPickedUpObject.GetComponent <Examinable>();
                            if (Examinable.Name == ItemName.AshesOfHappyVillage && !PickedupAshes)
                            {
                                MainNotification.Notify("<i>Oh! Seems like someone else already burnt the place down for you. How convenient.</i>", 5);
                                PickedupAshes = true;
                            }
                            if (Examinable.Name == ItemName.FireballBook && !LearnedFireball)
                            {
                                LearnedFireball = true;
                                HappyVillage.SetActive(false);
                                AshesOfTheVillage.SetActive(true);
                            }
                        }
                    }
                }
            }
        }
        // The "access inventory" action
        if (Input.GetButtonDown("Put Into / Pull From Bag"))
        {
            Pickup PreviousPickup = CurrentlyPickedUpObject;
            if (CurrentlyPickedUpObject != null)
            {
                ItemSounds Sfx = CurrentlyPickedUpObject.GetComponent <ItemSounds>();
                if (Sfx != null)
                {
                    Sfx.Close();
                }
                Examinable Examinable = CurrentlyPickedUpObject.GetComponent <Examinable>();
                CurrentlyPickedUpObject.gameObject.SetActive(false);
                CurrentlyPickedUpObject = null;
            }
            if (Inventory.Count > 0 && CurrentInventorySelectionIndex < Inventory.Count)
            {
                GameObject Item       = Inventory[CurrentInventorySelectionIndex];
                Pickup     ItemPickup = Item.GetComponent <Pickup>();
                if (ItemPickup != PreviousPickup)
                {
                    Item.SetActive(true);
                    CurrentlyPickedUpObject = ItemPickup;
                    ItemSounds Sfx = Item.GetComponent <ItemSounds>();
                    if (Sfx != null)
                    {
                        Sfx.Open();
                    }
                }
            }
            if (Inventory.Count > 1 && CurrentTutorialStage == TutorialStage.PostInventory0)
            {
                CurrentTutorialStage = TutorialStage.Inventory1;
            }
        }
        // The "look through inventory" action
        float Scroll = Input.GetAxis("Mouse ScrollWheel");

        if (Scroll != 0 && CurrentTutorialStage == TutorialStage.Inventory1)
        {
            CurrentTutorialStage = TutorialStage.Done;
        }
        if (Scroll < 0)
        {
            CurrentInventorySelectionIndex++;
            if (CurrentInventorySelectionIndex >= Inventory.Count)
            {
                CurrentInventorySelectionIndex = 0;
            }
        }
        else if (Scroll > 0)
        {
            CurrentInventorySelectionIndex--;
            if (CurrentInventorySelectionIndex < 0)
            {
                CurrentInventorySelectionIndex = Inventory.Count - 1;
            }
        }

        if (LearnedFireball && !LearnedFireballNotify && CurrentlyPickedUpObject == null)
        {
            MainNotification.Notify("<i>You now know how to cast Fireball!\n<size=20>(You know the title of the game. Pardon.)</size></i>", 5);
            LearnedFireballNotify = true;
        }

        for (int i = 1; i <= 10; i++)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(0, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(1, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(2, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha4))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(3, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha5))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(4, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha6))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(5, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha7))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(6, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha8))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(7, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha9))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(8, 0, Inventory.Count);
            }
            if (Input.GetKeyDown(KeyCode.Alpha0))
            {
                CurrentInventorySelectionIndex = Mathf.Clamp(9, 0, Inventory.Count);
            }
        }

        // Update inventory text
        string InventorySummary = "";

        if (Inventory.Count > 0)
        {
            InventorySummary += "Inventory:\n";
            for (int i = 0; i < Inventory.Count; i++)
            {
                GameObject Item       = Inventory[i];
                Pickup     ItemPickup = Item.GetComponent <Pickup>();
                InventorySummary += (i + 1) + ". ";
                if (CurrentlyPickedUpObject == ItemPickup)
                {
                    InventorySummary += "<b>" + Item.name + "</b>";
                }
                else
                {
                    InventorySummary += Item.name;
                }
                if (i == CurrentInventorySelectionIndex)
                {
                    if (CurrentlyPickedUpObject != ItemPickup)
                    {
                        InventorySummary += " (Right-click to equip)";
                    }
                    else
                    {
                        InventorySummary += " (Right-click to unequip)";
                    }
                }
                InventorySummary += "\n";
            }
        }
        InventoryDisplay.text = InventorySummary;

        // Update examination text
        string NewExaminationText = "";

        if (LookedAtObject != null)
        {
            Examinable Examinable = LookedAtObject.GetComponent <Examinable>();
            if (Examinable != null)
            {
                NewExaminationText = Examinable.ToString();
                if (CurrentTutorialStage == TutorialStage.None)
                {
                    CurrentTutorialStage = TutorialStage.Pickup;
                }
            }
        }
        if (NewExaminationText == "")
        {
            HoverTextAlpha = 0.0f;
        }
        else
        {
            HoverTextAlpha = 1.0f;
        }
        Color ExaminationTextColor = ExaminationText.color;

        ExaminationTextColor.a = Mathf.Lerp(ExaminationTextColor.a, HoverTextAlpha, 20f * Time.deltaTime);
        ExaminationText.color  = ExaminationTextColor;
        if (NewExaminationText != "")
        {
            ExaminationText.text = NewExaminationText;
        }

        // Update tutorial texts
        Color Color = PickupTutorial.color;

        Color.a = Mathf.Lerp(Color.a, CurrentTutorialStage == TutorialStage.Pickup ? 1 : 0, 5f * Time.deltaTime);
        PickupTutorial.color = Color;

        Color   = InventoryTutorial0.color;
        Color.a = Mathf.Lerp(Color.a, CurrentTutorialStage == TutorialStage.Inventory0 ? 1 : 0, 5f * Time.deltaTime);
        InventoryTutorial0.color = Color;

        Color   = InventoryTutorial1.color;
        Color.a = Mathf.Lerp(Color.a, CurrentTutorialStage == TutorialStage.Inventory1 ? 1 : 0, 5f * Time.deltaTime);
        InventoryTutorial1.color = Color;
    }
コード例 #26
0
    public void StartNextStep()
    {
        currentStage++;
        var but = planetInfoScreen?.Q("solve-button");
        Action <List <Tuple <TutorialScript.Actions, GameObject> > > permittedActionSetter = (List <Tuple <Actions, GameObject> > newPermitedAction) => { SetPermittedActions(newPermitedAction); };
        Action startNextStepHandler = () => { Invoke("StartNextStep", 0.5f); };

        switch (currentStage)
        {
        case TutorialStage.WaitingForStart:
            break;

        case TutorialStage.WaitingForCameraSolarPhase:
            StartCoroutine(_WaitForCameraPhase(CameraScript.Phase.Free));
            break;

        case TutorialStage.SolarSystemRotation:
            swipeTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter, TutorialSwipes.HintsPosition.Center);
            break;

        case TutorialStage.SolarSystemZoom:
            zoomTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.SolarSystemTap:
            tappingTutorial.EnableTutorial(tappingTarget, startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.WaitingForCameraPlanetLock:
            StartCoroutine(_WaitForCameraPhase(CameraScript.Phase.PlanetLock));
            break;

        case TutorialStage.PlanetRotation:
            but.SetEnabled(false);
            swipeTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter, TutorialSwipes.HintsPosition.Left);
            break;

        case TutorialStage.SolveClick:
            but.SetEnabled(true);
            but.style.backgroundImage = Resources.Load("UI/Buttons/SolveButtonTutorial") as Texture2D;
            but.RegisterCallback <ClickEvent>(eventOnClick);
            break;

        case TutorialStage.SolveSwipes:
            but.UnregisterCallback <ClickEvent>(eventOnClick);
            but.style.backgroundImage = Resources.Load("UI/Buttons/SolveButton") as Texture2D;
            swipeTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter, TutorialSwipes.HintsPosition.Center);
            break;

        case TutorialStage.SolveRotation:
            rotationTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.SolveDoubleTap:
            doubleTapTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.ChoosePiece:
            var puzzleObjects = GameObject.FindGameObjectsWithTag("piece");
            foreach (GameObject obj in puzzleObjects)
            {
                if (obj.GetComponent <Piece>() != null && obj.GetComponent <Renderer>().enabled == true)
                {
                    chosenPiece = obj;
                    tappingTutorial.EnableTutorial(chosenPiece, startNextStepHandler, permittedActionSetter);
                    return;
                }
            }
            break;

        case TutorialStage.PieceRotation:
            rotationTutorial.EnableTutorial(startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.PieceConfirm:
            tappingTutorial.EnableTutorial(chosenPiece, startNextStepHandler, permittedActionSetter);
            break;

        case TutorialStage.PiecePlacing:
            chosenPiece.GetComponent <Piece>().MakeTwinMarkedForTutorial();
            StartCoroutine(_WaitForPieceToFit());
            break;

        case TutorialStage.End:
            isTutorialEnabled = false;
            saveManager.MakeTutorialDone();
            notifyAboutTutorialEnding();
            pertitedAction.Clear();
            currentStage = TutorialStage.WaitingForStart;
            Debug.Log("Tutorial Ended");
            break;
        }
    }
コード例 #27
0
 public void EndTutoial()
 {
     isTutorialEnabled = false;
     currentStage      = TutorialStage.WaitingForStart;
 }
コード例 #28
0
 public void UpdateStage()
 {
     stage = TutorialManager.Instance.GetStage();
 }