Add menu scene, scene transition, simple position save and load

This commit is contained in:
LAPTOP-NFGSIHNQ\shump 2022-04-11 16:34:14 +03:00
parent 26e2d0d1db
commit 1ed57d5c31
25 changed files with 23436 additions and 130 deletions

View File

@ -474,7 +474,7 @@ GameObject:
- component: {fileID: 13646088}
m_Layer: 0
m_Name: hands_coll:b_r_index3
m_TagString: Untagged
m_TagString: Hand
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -502,8 +502,8 @@ CapsuleCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 157110}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 0
m_IsTrigger: 1
m_Enabled: 1
m_Radius: 0.01
m_Height: 0.05
m_Direction: 2
@ -2104,7 +2104,6 @@ Transform:
m_Children:
- {fileID: 4421233779495850}
- {fileID: 476420}
- {fileID: 4164307110522025874}
m_Father: {fileID: 4580479270500170}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2388,117 +2387,3 @@ Transform:
m_Father: {fileID: 4207000969376662}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &972614495230819995
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4164307110522025874}
- component: {fileID: 2024636151888384740}
- component: {fileID: 406863439724310501}
- component: {fileID: 6269533531215649841}
- component: {fileID: 4053915464836275328}
m_Layer: 0
m_Name: Sphere
m_TagString: Hand
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4164307110522025874
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972614495230819995}
m_LocalRotation: {x: 0.3485921, y: 0.6135567, z: 0.49798086, w: 0.5040306}
m_LocalPosition: {x: 0.102, y: -0.014, z: 0}
m_LocalScale: {x: 0.02, y: 0.02, z: 0.02}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4166430797808258}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2024636151888384740
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972614495230819995}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &406863439724310501
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972614495230819995}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &6269533531215649841
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972614495230819995}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &4053915464836275328
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 972614495230819995}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0

View File

@ -34,8 +34,8 @@ public class ArmSwingLocomotion : MonoBehaviour
float Yrot = CenterEyeCamera.transform.eulerAngles.y;
ForwardDirection.transform.eulerAngles = new Vector3(0, Yrot, 0);
/*float Yrot = CenterEyeCamera.transform.eulerAngles.y;
ForwardDirection.transform.eulerAngles = new Vector3(0, Yrot, 0);*/
PositionCurrentFrameLeftHand = LeftHand.transform.position;
PositionCurrentFrameRightHand = RightHand.transform.position;

View File

@ -22,10 +22,10 @@ public class EnableArmSwing : MonoBehaviour
{
if (other.tag == "Hand")
{
if(_renderer.material.color == Color.white)
Player.GetComponent<ArmSwingLocomotion>().enabled = true;
else
if(Player.GetComponent<ArmSwingLocomotion>().enabled == true)
Player.GetComponent<ArmSwingLocomotion>().enabled = false;
else
Player.GetComponent<ArmSwingLocomotion>().enabled = true;
}
}

View File

@ -22,10 +22,10 @@ public class EnableDash : MonoBehaviour
{
if (other.tag == "Hand")
{
if (_renderer.material.color == Color.white)
Player.GetComponent<Dash>().enabled = true;
else
if (Player.GetComponent<Dash>().enabled == true)
Player.GetComponent<Dash>().enabled = false;
else
Player.GetComponent<Dash>().enabled = true;
}
}

View File

@ -6,12 +6,14 @@ public class EnableJoyStick : MonoBehaviour
{
private MeshCollider _collider;
private MeshRenderer _renderer;
public GameObject LocomotionSystem;
// Start is called before the first frame update
void Start()
{
_collider = GetComponent<MeshCollider>();
_renderer = GetComponent<MeshRenderer>();
LocomotionSystem.SetActive(false);
}
@ -20,8 +22,7 @@ public class EnableJoyStick : MonoBehaviour
{
if (other.tag == "Hand")
{
LocomotionSystem.SetActive(true);
LocomotionSystem.SetActive(!LocomotionSystem.activeSelf);
}
}
}

View File

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class EnterGameScene : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
SceneManager.LoadScene("GameScene");
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f1114a137d02f184db2b6291d9d31cb5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ForwardDirection : MonoBehaviour
{
public GameObject CenterEyeCamera;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
float Yrot = CenterEyeCamera.transform.eulerAngles.y;
transform.eulerAngles = new Vector3(0, Yrot, 0);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 01869e86b22555a449cd53043f5c4afa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseMenu : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5a2662b3abecb914cad356619e832f13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
/*public int level;
public int health;*/
public void SavePlayer()
{
SaveSystem.SavePlayer(this);
}
public void LoadPlayer()
{
PlayerData data = SaveSystem.LoadPlayer();
Vector3 position;
position.x = data.position[0];
position.y = data.position[1];
position.z = data.position[2];
transform.position = position;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ff82a98832d12249b30083bc9ae2dd3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class PlayerData
{
/*public int level;
public int health;*/
public float[] position;
public PlayerData(Player player)
{
/*level = player.level;
health = player.health;*/
position = new float[3];
position[0] = player.transform.position.x;
position[1] = player.transform.position.y;
position[2] = player.transform.position.z;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cdb4de85d282744083c6d9cee4fef3c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
public static class SaveSystem
{
public static void SavePlayer(Player player)
{
BinaryFormatter formatter = new BinaryFormatter();
string path = Application.persistentDataPath + "/player.data";
FileStream stream = new FileStream(path, FileMode.Create);
PlayerData data = new PlayerData(player);
formatter.Serialize(stream, data);
stream.Close();
}
public static PlayerData LoadPlayer ()
{
string path = Application.persistentDataPath + "/player.data";
if (File.Exists(path))
{
BinaryFormatter formatter = new BinaryFormatter();
FileStream stream = new FileStream(path, FileMode.Open);
PlayerData data = formatter.Deserialize(stream) as PlayerData;
stream.Close();
return data;
}
else
{
Debug.Log("Save File not found in " + path);
return null;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49c2ebd233ef7a547b12ce163244e30a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class XRGUI : MonoBehaviour
{
[SerializeField]
private Button SettingsButton;
[SerializeField]
private Button LoadButton;
[SerializeField]
private Button ExitButton;
// Start is called before the first frame update
void Start()
{
SettingsButton.onClick.AddListener(() =>
{
});
LoadButton.onClick.AddListener(() =>
{
});
ExitButton.onClick.AddListener(() =>
{
Debug.Log("Clicked");
UnityEditor.EditorApplication.isPlaying = false;
});
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 37cfb6899ccd00b4280ac4eb92f84851
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8fd0e18070efeda42bb8ab22afe4a9fb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e45278868e3d39f45929cb5142b6c572
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2434,7 +2434,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1267549690}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.11000013, y: 0.5, z: 0}
m_LocalPosition: {x: 0, y: 0.5, z: 0}
m_LocalScale: {x: 10, y: 0.5, z: 10}
m_ConstrainProportionsScale: 0
m_Children: []

View File

@ -6,11 +6,14 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 0
path: Assets/Scenes/DO_NOT_TOUCH.unity
path: Assets/SimpleNaturePack/Scenes/DO_NOT_TOUCH.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
- enabled: 1
path: Assets/Scenes/JoonasP/SampleScene.unity
guid: 84eaff0e1a543c244920ec3c1b11b50f
- enabled: 1
path: Assets/Scenes/Shumpei/GameScene.unity
guid: 8fd0e18070efeda42bb8ab22afe4a9fb
m_configObjects:
Unity.XR.Oculus.Settings: {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260,
type: 2}