private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && charBoost) { StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && axeBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(0); StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && swordBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(1); StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && spellBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(2); StartCoroutine(PickUp(other)); } }
public static void Load(string playerName) { string path = playerName + "/savegame.dat"; if (File.Exists(Application.persistentDataPath + path)) { CharacterStats charSt = FindObjectOfType <CharacterStats>(); Debug.Log("Load"); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + playerName + "savegame.dat", FileMode.Open); CharacterData data = (CharacterData)bf.Deserialize(file); file.Close(); //TODO : Lataa arvot ScoreTable.currentPlayer = data.name; ScoreTable.SetScore(ScoreTable.currentPlayer, "score", data.score); CharacterStats.currentCharacterLevel = data.cCharLevel; CharacterStats.levelPojo = data.lPojo; CharacterStats.strength = data.str; CharacterStats.dexterity = data.dex; CharacterStats.vitality = data.vit; CharacterStats.energy = data.ene; charSt.maxHealth = data.mHealth; charSt.maxMana = data.mMana; charSt.replenishH = data.rHealth; charSt.replenishM = data.rMana; charSt.moveSpeed = data.fMoveSpeed; charSt.rotationSpeed = data.rotSpeed; charSt.BackwardsMoveSpeed = data.bMoveSpeed; charSt.jumpForce = data.jForce; Level1 = data._Level1; Level2 = data._Level2; Level3 = data._Level3; Level4 = data._Level4; Level5 = data._Level5; WeaponSwitch wep = FindObjectOfType <WeaponSwitch>(); wep.SwitchToThisWep(0); FindObjectOfType <Axe>().LoadAxeStats(); wep.SwitchToThisWep(1); FindObjectOfType <Sword>().LoadSwordStats(); wep.SwitchToThisWep(2); FindObjectOfType <Spell>().LoadSpellStats(); } }
public void RemoveStrength() { focusThisWeapon.SwitchToThisWep(0); if (strength > 0) { Debug.Log("Removed StR Point: "); strength -= 1; levelPojo += 1; axeStats.AxeOnPointRemove(bonusMulti * strength); statTexts[0].text = strength.ToString(); } }