Пример #1
0
    void FindUnlockedCars()
    {
        string data = "";

        if (System.IO.File.Exists(Application.persistentDataPath + UnlocksPath) && !OverriteSaveOnLoad)
        {
            //Debug.Log("File exists");
            data = ReadData(UnlocksPath);

            playerUnlocks = (PlayerUnlocks)JsonUtility.FromJson(data, typeof(PlayerUnlocks));
        }
        else
        {
            Debug.Log("Unlocks File does not exists or overrite is active");

            playerUnlocks       = new PlayerUnlocks();
            playerUnlocks.Coins = 10000;

            playerUnlocks.Distance.Add(0);
            playerUnlocks.Distance.Add(0);
            playerUnlocks.Distance.Add(0);

            playerUnlocks.Cars.Add(true);

            for (int i = 0; i < 6; i++)
            {
                playerUnlocks.Cars.Add(false);
            }
            SaveData(UnlocksPath, JsonUtility.ToJson(playerUnlocks));
        }
    }
Пример #2
0
 public void LoadNewGamePlus(Save s, int slotNum)
 {
     this.unlocks = s.unlocks;
     GlobalController.pc.maxHP      = s.maxHP;
     GlobalController.pc.maxEnergy  = s.maxEnergy;
     GlobalController.pc.baseDamage = s.basePlayerDamage;
 }
Пример #3
0
	void Start() {
		unlocks = GlobalController.save.unlocks;
		rb2d = GetComponent<Rigidbody2D>();
		anim = GetComponent<Animator>();
		options = GlobalController.save.options;
		this.facingRight = false;
        cyanMaterial = Resources.Load<Material>("Shaders/CyanFlash");
		spr = GetComponent<SpriteRenderer>();
        defaultMaterial = GetComponent<SpriteRenderer>().material;
		gunEyes = transform.Find("GunEyes").transform;
		gun = GetComponentInChildren<Gun>();
		interaction = GetComponentInChildren<InteractAppendage>();
		lastSafeOffset = this.transform.position;
		speedLimiter = GetComponent<SpeedLimiter>();
		spriteRenderers = new List<SpriteRenderer>(GetComponentsInChildren<SpriteRenderer>(includeInactive:true));
		combatActives = GetComponentsInChildren<ActiveInCombat>(includeInactive:true);
		diamondShine = Resources.Load("Effects/DiamondShine") as GameObject;
		airAttackTracker = GetComponent<AirAttackTracker>();
		RefreshAirMovement();
		deathEvent = Resources.Load("ScriptableObjects/Events/Player Death") as GameEvent;
		groundCheck = GetComponent<PlayerGroundCheck>();
		groundData = groundCheck.groundData;
		LoadFromSaveData(GlobalController.save);
		EnableTriggers();
	}
Пример #4
0
 public SerializableUnlocks(PlayerUnlocks p)
 {
     this.unlockedAbilities = p.unlockedAbilities;
     maxHP      = p.maxHP;
     maxEnergy  = p.maxEnergy;
     baseDamage = p.baseDamage;
 }
Пример #5
0
 public void LoadFromSaveData(Save s)
 {
     this.unlocks       = s.unlocks;
     this.maxEnergy     = s.maxEnergy;
     this.maxHP         = s.maxHP;
     this.currentEnergy = s.currentEnergy;
     this.currentHP     = s.currentHP;
     UpdateUI();
 }
Пример #6
0
 void Start()
 {
     onPlayer = gameObject.GetComponentInParent <GlobalController>() != null;
     if (!onPlayer)
     {
         return;
     }
     playerUnlocks = GlobalController.save.unlocks;
 }
Пример #7
0
	void LoadFromSaveData(Save s) {
		this.unlocks = s.unlocks;
		this.maxEnergy = s.maxEnergy;
		this.maxHP = s.maxHP;
		this.currentEnergy = s.currentEnergy;
		this.currentHP = s.currentHP;
		this.baseDamage = s.basePlayerDamage;
		this.options = s.options;
		UpdateUI();
	}
Пример #8
0
 void Start()
 {
     onPlayer = gameObject.GetComponentInParent <SaveWrapper>() != null;
     if (!onPlayer)
     {
         return;
     }
     playerUnlocks = gameObject.GetComponentInParent <SaveWrapper>()
                     .save
                     .unlocks;
 }
Пример #9
0
    void Awake()
    {
        if (Instance)
        {
            Destroy(gameObject);
            return;
        }

        Instance      = this;
        playerUnlocks = new PlayerUnlocks();
        DontDestroyOnLoad(gameObject);
    }
Пример #10
0
        private void BuyRandomItem()
        {
            if (!gameObject.activeSelf)
            {
                return;
            }

            if (Coins.Amount < goldRequirement)
            {
                //TODO What to do?
                Debug.Log("Not Enough Money.");
            }
            else
            {
                var lockSlots = _shopPages[_pageItem.CurrentIndex].GetLockedSlots();
                var itemSlot  = _shopPages[_pageItem.CurrentIndex].GetRandomItemSlot();

                var roulettetin =
                    StartCoroutine(RandomSlotHighlight(lockSlots));

                if (!itemSlot)
                {
                    return;
                }

                RefreshSelectedSlot();

                PlayerPreview.UnlockedNewItem(() =>
                {
                    StopCoroutine(roulettetin);

                    foreach (var lockSlot in lockSlots)
                    {
                        lockSlot.Roulette(false);
                    }

                    itemSlot.Unlocked();
                    itemSlot.Selected(true);

                    PlayerUnlocks.Unlock(itemSlot.Data);
                    Coins.Take(goldRequirement);
                    goldRequirement += incrementalRequirement;
                    itemSlot.Data.action.Execute(PlayerPreview.Player);
                    controlButtons.SetRequiredGold(goldRequirement);

                    RefreshSelectedSlot();
                });
            }
        }
Пример #11
0
        public List <StoreSlot> GetLockedSlots()
        {
            var lockedSlots = new List <StoreSlot>();

            foreach (var slot in _storeSlots)
            {
                if (!slot.Active || PlayerUnlocks.Has(slot.Data))
                {
                    continue;
                }

                lockedSlots.Add(slot);
            }

            return(lockedSlots);
        }
Пример #12
0
 void Start()
 {
     unlocks          = GetComponentInParent <PlayerUnlocks>();
     rb2d             = GetComponent <Rigidbody2D>();
     anim             = GetComponent <Animator>();
     this.facingRight = false;
     currentHP        = 5;  //unlocks.maxHP;
     currentEnergy    = 50; //unlocks.maxEnergy;
     maxEnergy        = 50;
     cyanMaterial     = Resources.Load <Material>("Shaders/CyanFlash");
     spr             = GetComponent <SpriteRenderer>();
     defaultMaterial = GetComponent <SpriteRenderer>().material;
     gunEyes         = transform.Find("GunEyes").transform;
     gun             = GetComponentInChildren <Gun>();
     interaction     = GetComponentInChildren <InteractAppendage>();
     wings           = transform.Find("Wings").GetComponent <PlayerWings>();
     anim.SetBool("CanSupercruise", unlocks.HasAbility(Ability.Supercruise));
     Flip();
     ResetAirJumps();
 }
 void Start()
 {
     unlocks          = GetComponentInParent <PlayerUnlocks>();
     rb2d             = GetComponent <Rigidbody2D>();
     anim             = GetComponent <Animator>();
     this.facingRight = false;
     currentHP        = unlocks.maxHP;
     currentEnergy    = unlocks.maxEnergy;
     maxEnergy        = 5;
     cyanMaterial     = Resources.Load <Material>("Shaders/CyanFlash");
     spr             = GetComponent <SpriteRenderer>();
     defaultMaterial = GetComponent <SpriteRenderer>().material;
     gunEyes         = transform.Find("GunEyes").transform;
     gun             = GetComponentInChildren <Gun>();
     interaction     = GetComponentInChildren <InteractAppendage>();
     Flip();
     ResetAirJumps();
     lastSafeOffset = this.transform.position;
     speedLimiter   = GetComponent <SpeedLimiter>();
 }
Пример #14
0
        public void InitializeItems(Store.StoreSlot[] slots, bool progressLock, ContentsLoader loader)
        {
            _contentsLoader = loader;
            _progressLock   = progressLock;
            HideButtons();

            for (int i = 0; i < maxSlot && i < slots.Length; i++)
            {
                if (!slots[i])
                {
                    continue;
                }

                _storeSlots[i].Show(slots[i]);

                if (PlayerUnlocks.Has(_storeSlots[i].Data))
                {
                    _storeSlots[i].Unlocked();
                }
            }
        }
Пример #15
0
 void Awake()
 {
     this.unlocks      = GetComponent <PlayerUnlocks>();
     persistentObjects = new Dictionary <string, SerializedPersistentObject>();
 }