protected override void Awake()
 {
     base.Awake();
     playerStats    = PlayerPersistence.LoadData();
     playerAnimator = GetComponent <Animator>();
     playerSoundEffectsController = GetComponent <PlayerSoundEffectsController>();
     device = InputManager.ActiveDevice;
 }
Example #2
0
    private void OnEnable()
    {
        //Oyun basladiginda Cektigimiz Datalari oyuna sokarak baslattik.

        PlayerData = PlayerPersistence.LoadData();

        PlayerLevel             = PlayerData.PlayerLevel;
        PlayerExperience        = PlayerData.PlayerExperience;
        PlayerAttributePoints   = PlayerData.AttributePoint;
        costModifierPoint       = PlayerData.CostAttributePoint;
        fireRateModifierPoint   = PlayerData.FireRateAttributePoint;
        projectileModifierPoint = PlayerData.ProjectileDamageAttributePoint;
        costModifier            = PlayerData.CostModifier;
        fireRateModifier        = PlayerData.FireRateModifier;
        projectileModifier      = PlayerData.ProjectileDamageModifier;
    }
 void OnEnable()
 {
     //playerData = new PlayerData();
     playerData = PlayerPersistence.LoadData();
     fullscreenToggle.onValueChanged.AddListener(delegate { onFullScreenToggle(); });
     resolutionDropdown.onValueChanged.AddListener(delegate { setResolution(); });
     colorBallDropdown.onValueChanged.AddListener(delegate { setColorBall(); });
     backgroundDropdown.onValueChanged.AddListener(delegate { setBackground(); });
     applyButton.onClick.AddListener(delegate { onApplyButtonClick(); });
     resolutions = Screen.resolutions;
     foreach (Resolution resolution in resolutions)
     {
         resolutionDropdown.options.Add(new Dropdown.OptionData(resolution.ToString()));
     }
     LoadSettings();
 }
Example #4
0
    //Load from save state
    public void OnEnable()
    {
        Debug.Log("Attempting to Load Game...");
        // Load existing Game
        playerData = PlayerPersistence.LoadData();

        if (playerData.PlayerLevel < 1)
        {
            Debug.Log("No save found..starting a new save");
            // Create new Data
            playerData = new PlayerData(true);
            // Save new Game
            PlayerPersistence.SaveData(playerData);
            playerData = PlayerPersistence.LoadData();
        }
        Debug.Log("GameController finished enabling");
    }
Example #5
0
    public IEnumerator Generate()
    {
        // term between each cell generation
        WaitForSeconds delay = new WaitForSeconds(generationStepDelay);

        PlayerSettings settings = PlayerPersistence.LoadData();

        PlayerPrefs.SetFloat("Scale", scale);

        // initialization when no stored values
        if (settings.MazeWidth == 0)
        {
            settings.MazeWidth = 10;
            PlayerPrefs.SetInt("mazeWidth", settings.MazeWidth);
            Debug.Log("MazeWidth Initialized: " + settings.MazeWidth);
        }
        if (settings.MazeHeight == 0)
        {
            settings.MazeHeight = 10;
            PlayerPrefs.SetInt("mazeHeight", settings.MazeHeight);
            Debug.Log("MazeHeight Initialized: " + settings.MazeHeight);
        }
        size.x = settings.MazeWidth;
        size.z = settings.MazeHeight;

        // initialize cell list
        cells = new MazeCell[size.x, size.z];
        List <MazeCell> activeCells = new List <MazeCell>();

        DoFirstGenerationStep(activeCells);
        while (activeCells.Count > 0)
        {
            yield return(delay);

            DoNextGenerationStep(activeCells);
        }

        numOfGoals = (size.x * size.z) / 25;
        PlayerPrefs.SetInt("GoalCount", 0);
        // set a goal at edge of the maze
        for (int i = 0; i < numOfGoals; i++)
        {
            CreateGoal();
            yield return(delay);
        }
    }
    void Start()
    {
        // load PlayerSettings including PlayerPrefs
        PlayerSettings settings = PlayerPersistence.LoadData();

        // load the values from the previous setting
        lblWidth.text   = settings.MazeWidth.ToString();
        lblHeight.text  = settings.MazeHeight.ToString();
        sldWidth.value  = settings.MazeWidth;
        sldHeight.value = settings.MazeHeight;

        var listAvailableStrings = ddlNumOfPlayers.options.Select(option => option.text).ToList();

        ddlNumOfPlayers.value = listAvailableStrings.IndexOf(settings.NumberOfPlayers.ToString());
        var listAvailableStrings2 = ddlTimeLimit.options.Select(option => option.text).ToList();

        ddlTimeLimit.value = listAvailableStrings2.IndexOf(settings.TimeLimit.ToString() + "s");
        var listAvailableStrings3 = ddlColor.options.Select(option => option.text).ToList();

        ddlColor.value = listAvailableStrings3.IndexOf(settings.Color);
    }
Example #7
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
     rb2d           = GetComponent <Rigidbody2D>();
     pc             = GetComponent <PlayerController>();
     bc2d           = GetComponent <BoxCollider2D>();
     gotHit         = false;
     regainHealth   = false;
     hitFromLeft    = false;
     hitFromRight   = false;
     dead           = false;
     PlayerInfo     = PlayerPersistence.LoadData();
     //transform.position = PlayerInfo.Position;
     if (hp > 0)
     {
         hp = PlayerInfo.Hp;
     }
     power      = PlayerInfo.Power;
     durability = PlayerInfo.Durability;
 }
Example #8
0
    // Use this for initialization
    void Start()
    {
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
        rb2d           = GetComponent <Rigidbody2D>();
        hp             = GetComponent <PlayerHealth>();
        moveInputs     = true;
        ledge          = false;
        gravity        = rb2d.gravityScale;
        boredChance    = 0;
        hitTime        = -1f;
        boostTime      = -1f;
        boosted        = false;
        attack         = false;
        attackCooldown = 0;
        weapon         = 0;
        throwable      = 0;
        throwCooldown  = 0;

        PlayerInfo = PlayerPersistence.LoadData();
        weapon     = PlayerInfo.Weapon;
        throwable  = PlayerInfo.Throwable;
    }