Example #1
0
    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);
    }