Esempio n. 1
0
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_29 lvlModel = data.levelsData.LB29;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
    private void MoveAnimations(Directions dir)
    {
        // Limit to only facing axis directions when moving.
        switch (axis)
        {
        case (Axis.x):
            if (dir == Directions.Up || dir == Directions.Down)
            {
                dir = npc.DefaultFacingDirection;
            }
            break;

        case (Axis.y):
            dir = npc.DefaultFacingDirection;
            break;

        case (Axis.z):
            if (dir == Directions.Right || dir == Directions.Left)
            {
                dir = npc.DefaultFacingDirection;
            }
            break;
        }

        bool isMoving = npc.transform.position != lastPosition;

        if (!isMoving)
        {
            npc.FaceDefaultDirection();
        }
        else
        {
            Script_Utils.AnimatorSetDirection(npc.MyAnimator, dir);
        }
    }
    public override void Load(Model_RunData data)
    {
        if (data.levelsData == null)
        {
            Debug.Log("There is no levels state data to load.");
            return;
        }

        if (data.levelsData.LB20 == null)
        {
            Debug.Log("There is no LB20 state data to load.");
            return;
        }

        Model_LevelBehavior_20 lvlModel = data.levelsData.LB20;

        LB20.isKingIntroCutSceneDone = lvlModel.isKingIntroCutSceneDone;
        LB20.season = lvlModel.season;
        LB20.entranceCutSceneDone = lvlModel.entranceCutSceneDone;
        LB20.isPuzzleComplete     = lvlModel.isPuzzleComplete;
        LB20.didPickUpMasterKey   = lvlModel.didPickUpMasterKey;
        LB20.didUnlockMasterLock  = lvlModel.didUnlockMasterLock;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
 public void GetDirection()
 {
     Script_Utils.GetDirectionToTarget(
         Ellenia.transform.position,
         Script_Game.Game.GetPlayer().transform.position
         );
 }
    public void LoadNames(Model_SaveData data)
    {
        if (data.namesData == null)
        {
            Debug.Log("There is no names state data to load.");
            return;
        }

        Model_Names names = new Model_Names(
            _Player:                    data.namesData.Player,
            _Ids:                       data.namesData.Ids,
            _Ero:                       data.namesData.Ero,
            _Myne:                      data.namesData.Myne,
            _Eileen:                    data.namesData.Eileen,
            _Ellenia:                   data.namesData.Ellenia,
            _Tedwich:                   data.namesData.Tedwich,
            _Ursie:                     data.namesData.Ursie,
            _Kaffe:                     data.namesData.Kaffe,
            _Latte:                     data.namesData.Latte,
            _KingEclaire:               data.namesData.KingEclaire,
            _Suzette:                   data.namesData.Suzette,
            _Peche:                     data.namesData.Peche,
            _Melba:                     data.namesData.Melba,
            _Moose:                     data.namesData.Moose,
            _Flan:                      data.namesData.Flan
            );

        Script_Names.LoadNames(names);

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(names);
    }
Esempio n. 6
0
    public void Push(Directions dir)
    {
        if (isMoving)
        {
            return;
        }
        if (_isDisabled)
        {
            return;
        }

        Vector3 desiredDir = Script_Utils.GetDirectionToVectorDict()[dir];

        // check for collisions
        // if no collisions then able to push, return true
        GetComponent <Script_InteractionBoxController>().HandleActiveInteractionBox(dir);
        bool isCollision = GetComponent <Script_CheckCollisions>().CheckCollisions(
            transform.position, dir, ref desiredDir
            );

        if (isCollision)
        {
            return;
        }

        startLocation = transform.position;
        endLocation   = transform.position + desiredDir;
        Move();
    }
Esempio n. 7
0
    /// <summary>
    /// fades out fullArt canvases and does callback after finishing fadeOut
    /// </summary>
    public void Hide(FadeSpeeds fadeOutMode, Action cb)
    {
        float fadeOutTime = Script_Utils.GetFadeTime(fadeOutMode);

        StartCoroutine(
            fullArtCanvasGroup
            .GetComponent <Script_CanvasGroupFadeInOut>()
            .FadeOutCo(fadeOutTime, () =>
        {
            fullArtCanvasGroup.gameObject.SetActive(false);

            foreach (var bg in bgs)
            {
                bg.gameObject.SetActive(false);
            }

            fullArtImage.gameObject.SetActive(false);
            fullArtImage.sprite = null;
            if (cb != null)
            {
                cb();
            }
        }
                       )
            );
    }
    public void ElleniaFacesPlayer()
    {
        Directions directionOfPlayer = Script_Utils.GetDirectionToTarget(
            Ellenia.transform.position, Script_Game.Game.GetPlayer().transform.position
            );

        Ellenia.FaceDirection(directionOfPlayer);
    }
Esempio n. 9
0
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_47 lvlModel = data.levelsData.LB47;

        LB47.didPickUpPuppeteerSticker = lvlModel.didPickUpPuppeteerSticker;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
Esempio n. 10
0
    private void Awake()
    {
        Script_Player player = Script_Game.Game.GetPlayer();
        Directions    dir    = Script_Utils.GetDirectionToTarget(
            player.transform.position, target.position
            );

        player.FaceDirection(dir);
    }
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_41 lvlModel = data.levelsData.LB41;

        LB41.didPickUpMelancholyPianoSticker = lvlModel.didPickUpMelancholyPianoSticker;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_10 lvlModel = data.levelsData.LB10;

        LB10.gotBoarNeedle = lvlModel.gotBoarNeedle;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
    public void FacePlayer()
    {
        Script_Player player = Script_Game.Game.GetPlayer();
        Directions    dir    = Script_Utils.GetDirectionToTarget(
            transform.position, player.transform.position
            );

        GetComponent <Script_MovingNPC>().FaceDirection(dir);
    }
Esempio n. 14
0
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_27 lvlModel = data.levelsData.LB27;

        LB27.GotPsychicDuck = lvlModel.gotPsychicDuck;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
Esempio n. 15
0
    private void HandlePopulateById()
    {
        if (!String.IsNullOrEmpty(Id))
        {
            string unformatted = Script_UIText.Text[Id].EN;
            string formatted   = Script_Utils.FormatString(unformatted);

            GetComponent <TextMeshProUGUI>().text = formatted;
        }
    }
Esempio n. 16
0
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_46 lvlModel = data.levelsData.LB46;

        LB46.isPuzzleComplete = lvlModel.isPuzzleComplete;
        LB46.didPlayFaceOff   = lvlModel.didPlayFaceOff;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_48 lvlModel = data.levelsData.LB48;

        LB48.IsDone       = lvlModel.isDone;
        LB48.IsFinalRound = lvlModel.isFinalRound;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
Esempio n. 18
0
    /// <summary>
    /// Used to show predefined hint canvases
    /// </summary>
    public void FadeIn(Script_Hint hint, Action cb = null)
    {
        hintCanvasGroup.Initialize();
        hint.gameObject.SetActive(true);

        hintCanvasGroup.gameObject.SetActive(true);

        float fadeTime = Script_Utils.GetFadeTime(hint.fadeSpeed);

        StartCoroutine(hintCanvasGroup.FadeInCo(fadeTime, cb));
    }
    public override void Load(Model_RunData data)
    {
        Model_LevelBehavior_42 lvlModel = data.levelsData.LB42;

        LB42.didPickUpLastWellMap = lvlModel.didPickUpLastWellMap;
        LB42.didPickUpSpeedSeal   = lvlModel.didPickUpSpeedSeal;
        LB42.isMooseQuestDone     = lvlModel.isMooseQuestDone;
        LB42.didPlayFaceOff       = lvlModel.didPlayFaceOff;

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(lvlModel);
    }
    public static void SetPath()
    {
        saveFileName = Script_Utils.SaveFile(saveSlotId);
        savedGameTitleDataFileName = Script_Utils.SaveTitleDataFile(saveSlotId);

        path = Application.persistentDataPath;

        saveFilePath           = $"{path}/{saveFileName}";
        savedGameTitleDataPath = $"{path}/{savedGameTitleDataFileName}";

        Debug.Log($"Persistent path is: {Application.persistentDataPath}");
        Debug.Log($"Currently using path: {path}");
    }
Esempio n. 21
0
    public void LoadPlayerData(Model_SaveData data)
    {
        Model_PlayerState p = new Model_PlayerState(
            data.playerData.spawnX,
            data.playerData.spawnY,
            data.playerData.spawnZ,
            data.playerData.faceDirection
            );

        game.SetPlayerState(p);

        Debug.Log($"-------- LOADED {name} --------");
        Script_Utils.DebugToConsole(p);
    }
Esempio n. 22
0
    private void Awake()
    {
        foreach (Script_MovingNPC npc in movingNPCs)
        {
            Directions faceDirection = Script_Utils.GetDirectionToTarget(
                npc.transform.position,
                Script_Game.Game.GetPlayer().transform.position
                );

            Debug.Log($"npc {npc.name} face {faceDirection}");
            npc.FaceDirection(faceDirection);
        }
        this.gameObject.SetActive(false);
    }
    public void SetTileMapTransparent()
    {
        tm         = GetComponent <Tilemap>();
        tmpColor   = tm.color;
        tmpColor.a = 0f;

        // first find all tile locations and set to transparent
        tileLocs.Clear();
        tileLocs = Script_Utils.AddTileLocs(tileLocs, tm,
                                            tileLoc => {
            tm.SetTileFlags(tileLoc, TileFlags.None);
            tm.SetColor(tileLoc, tmpColor);
        }
                                            );
    }
Esempio n. 24
0
    void MoveAnimation(Directions dir)
    {
        Directions myFaceDirection = ToOppositeDirectionZ(dir);

        Script_Utils.AnimatorSetDirection(animator, myFaceDirection);

        bool isMoving = Script_Game.Game.GetPlayer().MyAnimator.GetBool(PlayerMovingBool);

        SetIsMoving(isMoving);

        if (positionAdjuster != null)
        {
            positionAdjuster.Adjust(myFaceDirection);
        }
    }
    public void FadeOut(FadeSpeeds fadeSpeed, Action cb)
    {
        float fadeOutTime = Script_Utils.GetFadeTime(fadeSpeed);

        StartCoroutine(
            GetComponent <Script_CanvasGroupFadeInOut>()
            .FadeOutCo(fadeOutTime, () =>
        {
            if (cb != null)
            {
                cb();
            }
        }
                       )
            );
    }
    public void FadeIn(FadeSpeeds fadeSpeed, Action cb, float maxAlpha = 1f)
    {
        float fadeInTime = Script_Utils.GetFadeTime(fadeSpeed);

        StartCoroutine(
            GetComponent <Script_CanvasGroupFadeInOut>()
            .FadeInCo(fadeInTime, () =>
        {
            if (cb != null)
            {
                cb();
            }
        },
                      maxAlpha
                      )
            );
    }
    // public bool[] CreateIObjsWithSwitchesState(
    //     bool[] switchesStates,
    //     bool isActivated,
    //     bool isForceSortingLayer,
    //     bool isSortingLayerAxisZ = true,
    //     int offset = 0
    // )
    // {
    //     if (isActivated)
    //     {
    //         game.CreateInteractableObjects(
    //             switchesStates,
    //             isForceSortingLayer,
    //             isSortingLayerAxisZ,
    //             offset
    //         );
    //     }
    //     else
    //     {
    //         game.CreateInteractableObjects(
    //             null,
    //             isForceSortingLayer,
    //             isSortingLayerAxisZ,
    //             offset
    //         );

    //         switchesStates = new bool[game.GetSwitchesCount()];
    //         SetInitialSwitchesState(switchesStates);
    //     }

    //     return switchesStates;
    // }

    public bool[] SetupSwitchesState(
        Transform lightSwitchesParent,
        bool[] switchesStates,
        bool isInitialize
        )
    {
        /// Initialization of switches state is done in InteractableObjectCreator
        Script_Utils.PrintArray(switchesStates, "setting up with switchesState");

        switchesStates = game.SetupSwitches(
            lightSwitchesParent,
            switchesStates,
            isInitialize
            );

        return(switchesStates);
    }
    /// <summary>
    /// Handles copying thoughts into slots
    /// </summary>
    public void UpdatePlayerThoughts(
        Model_Thought thought,
        Model_PlayerThoughts thoughts,
        Script_PlayerThoughtsInventoryButton[] thoughtSlots
        )
    {
        foreach (Script_PlayerThoughtsInventoryButton ts in thoughtSlots)
        {
            ts.text.text = string.Empty;
        }

        // works ONLY if thoughts is exactly equal to maxHP
        for (int i = 0; i < thoughts.uglyThoughts.Count; i++)
        {
            string newThoughtText = thoughts.uglyThoughts[i].thought;
            thoughtSlots[i].text.text = Script_Utils.FormatString(newThoughtText);
        }
    }
    public static bool Copy(int fromSlot, int newSlotId)
    {
        SetPath();

        try
        {
            // copy saveData
            var fromFileName          = Script_Utils.SaveFile(fromSlot);
            var fromTitleDataFileName = Script_Utils.SaveTitleDataFile(fromSlot);

            var newFileName          = Script_Utils.SaveFile(newSlotId);
            var newTitleDataFileName = Script_Utils.SaveTitleDataFile(newSlotId);

            var fromFilePath          = $"{path}/{fromFileName}";
            var fromTitleDataFilePath = $"{path}/{fromTitleDataFileName}";

            var newFilePath          = $"{path}/{newFileName}";
            var newTitleDataFilePath = $"{path}/{newTitleDataFileName}";

            Debug.Log($"From File Path: {fromFilePath}");
            Debug.Log($"To File Path: {newFilePath}");

            Debug.Log($"From Title Data File Path: {fromTitleDataFilePath}");
            Debug.Log($"To Title Data File Path: {newTitleDataFilePath}");

            if (File.Exists(fromFilePath))
            {
                File.Copy(fromFilePath, newFilePath, true);
            }

            // copy titleData
            if (File.Exists(fromTitleDataFilePath))
            {
                File.Copy(fromTitleDataFilePath, newTitleDataFilePath, true);
            }

            return(true);
        }
        catch (System.Exception e)
        {
            Debug.LogError("Failed Copy with exception: " + e.ToString());
            return(false);
        }
    }
Esempio n. 30
0
    public void ShowThought(Model_Thought thought)
    {
        // stop any coroutine here
        if (isShowingThought)
        {
            StopCoroutine(coroutine);
            thoughtText.text = "";
        }

        isShowingThought = true;

        thoughtText.text = Script_Utils.FormatString(thought.thought);

        canvasGroup.gameObject.SetActive(true);
        canvasGroup.alpha          = 1f;
        canvasGroup.blocksRaycasts = true;

        audioSource.PlayOneShot(thoughtStartSoundFX, 1.0f);
    }