public void CreateProfile(string name) { SProfilePlayer.setInstance(new SProfilePlayer(name)); SProfilePlayer.getInstance().AchievementsManager.AddStepAchievement(AchievementEvent.createProfile); SProfilePlayer.getInstance().SpritesAchievements = SpritesAchievements; SProfilePlayer.getInstance().DefaultSprite = DefaultSprite; }
public void HideLogPanel() { PlayerNameText.text = Strings.Menu["Hi"] + SProfilePlayer.getInstance().Name; LogButton.SetActive(true); DeleteButton.SetActive(true); LogPanel.SetActive(false); }
private void displayInfo() { if (queue.Count > 0) { AchievementInfo achInfo = queue.Peek(); Text.text = achInfo.Name; Texture2D texture = SProfilePlayer.getInstance().DefaultSprite; if (SProfilePlayer.getInstance().SpritesAchievements != null) { foreach (var t in SProfilePlayer.getInstance().SpritesAchievements) { if (t.name.Equals(achInfo.Name)) { texture = t; } } } else { Debug.LogError("Lance la scene depuis le menu !"); } Image.texture = texture; speed = -GameVariables.Achievements.PopUp.speedCome; } }
public void TutorialCalled(string tutoName) { if (SProfilePlayer.getInstance().TutorialsCalled.Contains(tutoName)) { return; } SProfilePlayer.getInstance().TutorialsCalled.Add(tutoName); }
public void SetDiffilculty() { selectedDifficulty = SProfilePlayer.getInstance().Difficulty; foreach (SO.WolfStats wolfStats in wolvesStats) { wolfStats.SetDifficulty(difficultySettings, selectedDifficulty); } }
public static SProfilePlayer getInstance() { if (instance == null) { instance = new SProfilePlayer(); } return(instance); }
public void OpenTutorial(string tutoName) { if (SProfilePlayer.getInstance().TutorialsCalled.Contains(tutoName)) { return; } GameManager.instance.PauseGame(); scriptTuto.ShowTuto(tutoName); }
//Choose difficulty of game public void PlayWithDifficulty(int difficulty) { HideAllPanels(); LogButton.SetActive(false); DeleteButton.SetActive(false); LoadingScreen.SetActive(true); SProfilePlayer.getInstance().Difficulty = difficulty; // to be use in game SceneManager.LoadSceneAsync(1); }
public void SetCurrentGunStats() { gunStats.DamageMultiplier = 1f; gunStats.FireRateMultiplier = 1f; if (SProfilePlayer.getInstance().AchievementsManager.GetAchievementByName("Shoot").IsComplete()) { gunStats.DamageMultiplier = 1.1f; } // ... gunStats.Init(); }
public void Start() { // hide the panel to select profiles when we come back to this scene (from the scene of the game) if (SProfilePlayer.getInstance().Name.Equals("<Default>")) { LogPanel.SetActive(true); } else { PlayerNameText.text = Strings.Menu["Hi"] + SProfilePlayer.getInstance().Name; LogButton.SetActive(true); DeleteButton.SetActive(true); LogPanel.SetActive(false); } }
public void callAchievement(AchievementEvent achEvent, int step = 1) { List <AchievementInfo> endedAchievements = SProfilePlayer.getInstance().AchievementsManager.AddStepAchievement(achEvent, step); // hack fix to prevent bug when quitting the game if (achEvent == AchievementEvent.quit) { return; } if (endedAchievements != null) { foreach (var achInfo in endedAchievements) { AchievementPopUp.GetComponent <AchievementPopUpScript>().AddAchievement(achInfo); } } }
public void LoadProfile(string fullName) { if (File.Exists("./saves/" + fullName)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open("./saves/" + fullName, FileMode.Open); SProfilePlayer.setInstance((SProfilePlayer)bf.Deserialize(file)); file.Close(); SProfilePlayer.getInstance().AchievementsManager.ResetManagerOnAchievementInfos(); SProfilePlayer.getInstance().SpritesAchievements = SpritesAchievements; SProfilePlayer.getInstance().DefaultSprite = DefaultSprite; } else { Debug.LogWarning("file not found"); CreateProfile("Lost Save"); } }
static public void SaveProfile() { if (SProfilePlayer.getInstance().Name.Equals("<Default>")) { return; } if (!File.Exists("./saves")) { System.IO.Directory.CreateDirectory("./saves"); } DeleteProfile(SProfilePlayer.getInstance().Name); FileStream file = File.Create("./saves/" + SProfilePlayer.getInstance().Name + "-" + DateTime.Now.ToLongDateString().Split(',')[1] + ".save"); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, SProfilePlayer.getInstance()); file.Close(); }
private void Start() { soundManager = gameObject.GetComponent <SoundManager>(); _enclosureManager = EnclosureManager.Instance; cycleManager = CycleManagerObject.GetComponent <CycleManager>(); cycleManager.SubscribCycle(this); cycleManager.GoToAngle(1, 30); TotalSheeps = GameVariables.Initialisation.numberSheeps; Time.timeScale = 1; GetComponent <DifficultyManager>().SetDiffilculty(); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; if (SProfilePlayer.getInstance().AchievementsManager.GetAchievementByName("Player").IsComplete()) { TotalSuperSheeps = 1; } else { TotalSuperSheeps = 0; } DayStart(); }
public void CreateListPanel() { if (elements == null) { elements = new List <GameObject>(); } else { foreach (var go in elements) { UnityEngine.Object.Destroy(go); } } elements = new List <GameObject>(); float padding = 150f; int sizeList = SProfilePlayer.getInstance().AchievementsManager.getAchivements().Count; if (sizeList % 2 != 0) { sizeList++; } ListAchievements.GetComponent <RectTransform>().sizeDelta = new Vector2(padding * sizeList + 20f, 0); ListAchievements.transform.localPosition += new Vector3((sizeList * padding) / 2, 0, 0); float x = ((sizeList * padding) + padding) / 2f + 50f; bool createBottom = false; foreach (var achInfo in SProfilePlayer.getInstance().AchievementsManager.getAchivements()) { x -= (createBottom)? 0 : padding * 2f; int y = (int)((createBottom) ? padding : -padding); createBottom = !createBottom; GameObject r = Instantiate(AchievementPrefab, ListAchievements.transform); elements.Add(r); Texture2D texture = ObjectMainMenu.GetComponent <ProfileManager>().DefaultSprite; if (achInfo.IsComplete()) { texture = ObjectMainMenu.GetComponent <ProfileManager>().CompletedSprite; } else { foreach (var t in ObjectMainMenu.GetComponent <ProfileManager>().SpritesAchievements) { if (t.name.Equals(achInfo.Name)) { texture = t; } } } r.GetComponent <RawImage>().texture = texture; r.GetComponent <ScriptDisplayAchievement>().Name = achInfo; r.GetComponent <ScriptDisplayAchievement>().MenuGO = ObjectMainMenu; r.GetComponent <Button>().onClick.AddListener(r.GetComponent <ScriptDisplayAchievement>().Load); r.transform.localScale = new Vector3(1f, 1f, 1f); r.transform.localPosition = new Vector3(x, y, 0); //set attributes Text name = r.transform.Find("Name").GetComponent <Text>(); name.text = achInfo.Name; } }
public void DeleteCurrentProfile() { ProfileManager.DeleteProfile(SProfilePlayer.getInstance().Name); ShowLogPanel(); }
public static void setInstance(SProfilePlayer spp) { instance = spp; }