// Load actorA saved game public void Load() { print("Loading..."); StorageHandler sh = new StorageHandler(); PlayerData dp = (PlayerData)sh.LoadData("player") as PlayerData; _pd = dp; PlayerDataTracker pdt = PlayerDataTracker.GetInstance(); pdt.Dt = _pd; PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY(), pdt.GetPlayerZ()), Quaternion.identity); PlayerPrefab.gameObject.name = "Player"; this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab; C.transform.position = new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY() + 10, pdt.GetPlayerZ()); C.transform.parent = PlayerPrefab.transform; _dta = TempDataTracker.GetInstance(); _settingsReader = SettingsReader.GetInstance(); _cam = GameObject.Find("Main Camera"); _environmentController = EnvironmentController.GetInstance(); _gm = GeneticsManager.GetInstance(); _co = CollisionMediator.GetInstance(); _am = AudioManager.GetInstance(); }
public static PlayerDataTracker GetInstance() { if (!Instance) { Container = new GameObject(); Container.name = "PlayerDataTracker"; Instance = Container.AddComponent(typeof(PlayerDataTracker)) as PlayerDataTracker; } return(Instance); }
//public Stack<string> inventory; void Awake() { if (!i) { i = this; DontDestroyOnLoad(gameObject); } else { DestroyImmediate(gameObject); } }
private void Awake() { _pt = PlayerDataTracker.GetInstance(); SettingsReader = SettingsReader.GetInstance(); _pt.SetSpeed(SettingsReader.PlayerSpeed); // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime _player = ReInput.players.GetPlayer(PlayerId); // Get the character controller _cc = GetComponent <CharacterController>(); }
private void Awake() { _environment = EnvironmentController.GetInstance(); _pt = PlayerDataTracker.GetInstance(); _pc = GetComponent <ControllerSetup>(); // create list of limbs var t = transform; foreach (Transform child in t) { if (child.gameObject.name.Contains("limb_")) { Limbs.Add(child.gameObject.transform); if (child.gameObject.name.Contains("limb_0")) { Limbs0.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_1")) { Limbs1.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_2")) { Limbs2.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_3")) { Limbs3.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_4")) { Limbs4.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_5")) { Limbs5.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_6")) { Limbs6.Add(child.gameObject.transform); } if (child.gameObject.name.Contains("limb_7")) { Limbs7.Add(child.gameObject.transform); } } } }
private void Awake() { _evolutonBools = new List <bool>(); _evolutonBools.Add(false); _evolutonBools.Add(false); _evolutonBools.Add(false); _evolutonBools.Add(false); _evolutonBools.Add(false); _evolutonBools.Add(false); _evolutonBools.Add(false); SettingsReader = SettingsReader.GetInstance(); Mn = GameObject.Find("Controller").GetComponent <Main>(); _pc = GetComponent <PlayerController>(); _cs = GetComponent <ControllerSetup>(); _pt = PlayerDataTracker.GetInstance(); }
private void Awake() { _fadeScr = GameObject.FindObjectOfType <ScreenFader>(); // Create actorA temporary reference to the current scene. Scene currentScene = SceneManager.GetActiveScene(); _sceneName = currentScene.name; _sc = GameObject.Find("UI Controller").GetComponent <GameStatusManager>(); print("-------- " + _sc.GameStatus.ToString()); if (_sc.GameStatus == 4) { print("First start..."); _dta = TempDataTracker.GetInstance(); _settingsReader = SettingsReader.GetInstance(); _cam = GameObject.Find("Main Camera"); _environmentController = EnvironmentController.GetInstance(); _gm = GeneticsManager.GetInstance(); _co = CollisionMediator.GetInstance(); _am = AudioManager.GetInstance(); PlayerDataTracker pdt = PlayerDataTracker.GetInstance(); _pd = pdt.Dt; var s = _settingsReader.FoodWideSpreadY; _defaultN = s; PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(0, s, 0), Quaternion.identity); PlayerPrefab.gameObject.name = "Player"; pdt.SetEnergy(_settingsReader.PlayerStartEnergy); this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab; } else if (_sc.GameStatus == 3) { Load(); } C = Camera.main; C.transform.position = new Vector3(PlayerPrefab.transform.position.x, PlayerPrefab.transform.position.y + 10, PlayerPrefab.transform.position.z); C.transform.parent = PlayerPrefab.transform; }
// Saves player's current money, amount to be lost and mine data, passed out public static void SaveStatePassout() { statepassout = new PlayerDataTracker(Game1.player.Money, Math.Min(config.PassOutPenalty.MoneyLossCap, Game1.player.Money * (1 - config.PassOutPenalty.MoneytoRestorePercentage))); }
// Saves player's current money, amount to be lost and mine data, killed public static void SaveStateDeath() { statedeath = new PlayerDataTracker(Game1.player.Money, Math.Min(config.DeathPenalty.MoneyLossCap, Game1.player.Money * (1 - config.DeathPenalty.MoneytoRestorePercentage))); }