void SavePlayer() { CreatePlayerNode(); PlayerNode player = new PlayerNode(GetXmlNode(XmlNodes.Player.player)); player.SetPosition(SingletonManager.Player.GetComponent <Transform>().position); // y rotation is from player, x rotation is from camera... Vector3 rotationPlayer = SingletonManager.Player.GetComponent <Transform>().eulerAngles; player.SetRotation(new Vector3(Camera.main.transform.eulerAngles.x, rotationPlayer.y, rotationPlayer.z)); // Debug.Log("Camera : " + Camera.main.transform.eulerAngles.x); // Debug.Log("Player : " + rotationPlayer.y); float oxygen = SingletonManager.Player.GetComponent <PlayerOxygen>().m_current; player.SetOxygen(oxygen); float battery = SingletonManager.Player.GetComponent <PlayerBattery>().m_current; player.SetBattery(battery); player.SetFlashLight(FlashLight.GetInstance().m_hasBeenPickedUp); }
void Start() { m_flashLight = FlashLight.GetInstance(); // FLASHLIGHT UpdateCosts(); }
public override void Interact() { base.Interact(); #if DEBUG Debug.Log("Interacting with chest: " + this.gameObject.name); #endif Inventory inventory = GameObject.FindGameObjectWithTag(StringManager.Tags.player).GetComponent <Inventory>(); // disable item visibility m_item.SetEnableState(false); // item specific things switch (m_item.m_type) { case ItemType.Key: break; case ItemType.FlashLight: FlashLight.GetInstance().SetPickup(); if (SingletonManager.GameManager.m_isTutorial == false) { m_door.GetComponent <ObjectInteractionDoor>().enabled = true; } //SingletonManager.TextToSpeech.DoTextToSpeech(TextToSpeechType.FlashLightPickup); m_suit.SetActive(false); break; case ItemType.SnapLight: break; } if (m_item.m_isThrowable) { inventory.AddItem(m_item); } // disable interacting Disable(); }
void LoadPlayer() { CreatePlayerNode(); PlayerNode player = new PlayerNode(GetXmlNode(XmlNodes.Player.player)); SingletonManager.Player.GetComponent <Transform>().position = player.GetPosition(); // set player-y rotation Vector3 rotation = player.GetRotation(); SingletonManager.Player.GetComponent <Transform>().eulerAngles = new Vector3(0.0f, rotation.y, 0.0f); // set camera-x rotation, this junk doesnt work, rotation will be f****d up all the time... idk //Camera.main.transform.eulerAngles = new Vector3(rotation.x, 0.0f, 0.0f); Debug.Log("Camera: " + rotation.x.ToString()); Debug.Log("Player: " + rotation.y.ToString()); SingletonManager.Player.GetComponent <PlayerOxygen>().m_current = player.GetOxygen(); SingletonManager.Player.GetComponent <PlayerBattery>().m_current = player.GetBattery(); FlashLight.GetInstance().m_hasBeenPickedUp = player.GetFlashLight(); }
void Update() { /* * // just a delay on first run => so no Singleton errors occour * if (m_runTimer > 0.0f) * { * m_runTimer -= Time.deltaTime; * if (m_runTimer < 0.0f) * { * m_runTimer = 0.0f; * if (SingletonManager.GameManager.m_isTutorial && SingletonManager.GameManager.m_isSaveGame == false) * { * //RunTutorial(); * } * else * { * // no tutorial level !! * // remove suit * // enable lights * //m_suit.SetActive(false); * //m_suit2.SetActive(false); * //FlashLight.GetInstance().SetPickup(); * } * } * } */ UpdateTutorialStateTimer(); // update tutorial state switch (m_currentTutorialState) { case TutorialState.Camera: m_currentCameraMovement += Mathf.Abs((Input.GetAxis("Mouse Y")) + Mathf.Abs(Input.GetAxis("Mouse X"))); if (m_currentCameraMovement >= 0.1f) { if (m_isTutorialStateDone[m_currentTutorialState] == false) { SetTutorialStateDelay(3.0f); // delay as alex wanted SetTutorialStateDone(m_currentTutorialState); } } break; case TutorialState.Movement: if (Input.GetKey(SingletonManager.GameManager.m_gameControls.forward) || Input.GetKey(SingletonManager.GameManager.m_gameControls.backward) || Input.GetKey(SingletonManager.GameManager.m_gameControls.left) || Input.GetKey(SingletonManager.GameManager.m_gameControls.right)) { if (m_isTutorialStateDone[m_currentTutorialState] == false) { SetTutorialStateDone(m_currentTutorialState); } } break; case TutorialState.Interact: if (FlashLight.GetInstance().m_hasBeenPickedUp) { // player looked at interaction object if (m_isTutorialStateDone[m_currentTutorialState] == false) { // enable ui m_currentTutorialState = TutorialState.None; SingletonManager.UIManager.SetBatteryUIState(true); SingletonManager.UIManager.ToggleMinimap(true); m_currentTutorialState = TutorialState.Interact; SetTutorialStateDone(m_currentTutorialState); } } break; case TutorialState.OxygenBattery: if (m_isTutorialStateDone[m_currentTutorialState] == false) { // Add blink effect SingletonManager.UIManager.FlashOxygenAndBattery(GetTutorialStateDelay(m_currentTutorialState)); SetTutorialStateDone(m_currentTutorialState); } break; case TutorialState.Door: if (m_isTutorialStateDone[m_currentTutorialState] == false) { m_door.GetComponent <ObjectInteractionDoor>().enabled = true; //SetTutorialStateDone(m_currentTutorialState); } break; } // door timer if (m_doorTimer > 0.0f && m_currentTutorialState == TutorialState.Door) { m_doorTimer -= Time.deltaTime; if (m_doorTimer < 0.0f) { m_doorTimer = 0.0f; SingletonManager.TextToSpeech.DoTextToSpeech(TextToSpeechType.TutorialDoor, m_ttsDelay); } } }