void Start() { StartCoroutine(ShowCredits()); source = GetComponent <AudioSource>(); StatsAndOther stats = GameObject.FindGameObjectWithTag("StatsAndOther").GetComponent <StatsAndOther>(); source.clip = stats.hiddenLevelReached ? clips[0] : clips[1]; source.Play(); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; }
private void Start() { weaponManager = GetComponentInChildren <WeaponManager>(false); isChangingWeapon = false; gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>(); // sincronizzazione delle eventuali armi sbloccate nei livelli precedenti stats = GameObject.FindGameObjectWithTag("StatsAndOther").GetComponent <StatsAndOther>(); for (int i = 0; i < weapons.Length; i++) { weapons[i]._isUnlocked = stats.IsWeaponUnlocked(weapons[i]._id); UnlockWeapon(weapons[i].name, false); } }
//List<WeaponProps> unlockedWeapons = new List<WeaponProps>(); public void SaveWeapons(GameObject player) { StatsAndOther stats = GameObject.FindGameObjectWithTag("StatsAndOther").GetComponent <StatsAndOther>(); WeaponProps[] weapons = player.GetComponent <FPSController>().weaponHolder.GetComponent <WeaponHolderManager>().weapons; foreach (WeaponProps wp in weapons) { if (wp._isUnlocked) { stats.AddUnlockedWeapon(wp._id); } } }