Some edits

This commit is contained in:
haitem 2022-01-29 03:15:33 +01:00
parent 4a9967baa9
commit 94950a79a1
7 changed files with 92 additions and 14 deletions

View File

@ -9,8 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Neon_green 1 m_Name: Neon_green 1
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _EMISSION m_ShaderKeywords:
m_LightmapFlags: 2 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
@ -36,7 +36,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _EmissionMap: - _EmissionMap:
m_Texture: {fileID: 2800000, guid: 4d42022c70fc0a64a92c678cbc70449f, type: 3} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
@ -74,6 +74,6 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 0, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.4392157, g: 5.1137257, b: 5.992157, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709945}
- component: {fileID: 8768991388683709948} - component: {fileID: 8768991388683709948}
- component: {fileID: 3861707493128515586} - component: {fileID: 3861707493128515586}
- component: {fileID: 5765921883283663682}
m_Layer: 0 m_Layer: 0
m_Name: Platform m_Name: Platform
m_TagString: platform m_TagString: platform
@ -128,3 +129,16 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 0 type: 0
--- !u!65 &5765921883283663682
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 1, z: 0}

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709945}
- component: {fileID: 8768991388683709948} - component: {fileID: 8768991388683709948}
- component: {fileID: 1430690303722568316} - component: {fileID: 1430690303722568316}
- component: {fileID: 4716169668968050713}
m_Layer: 0 m_Layer: 0
m_Name: Platform_Blue m_Name: Platform_Blue
m_TagString: platform m_TagString: platform
@ -128,3 +129,16 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 0 type: 0
--- !u!65 &4716169668968050713
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 1, z: 0}

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709945}
- component: {fileID: 8768991388683709948} - component: {fileID: 8768991388683709948}
- component: {fileID: 3339862426328537977} - component: {fileID: 3339862426328537977}
- component: {fileID: 1376546613772517290}
m_Layer: 0 m_Layer: 0
m_Name: Platform_Green m_Name: Platform_Green
m_TagString: platform m_TagString: platform
@ -128,3 +129,16 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 1 type: 1
--- !u!65 &1376546613772517290
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 1, z: 0}

View File

@ -13,6 +13,8 @@ GameObject:
- component: {fileID: 8768991388683709950} - component: {fileID: 8768991388683709950}
- component: {fileID: 8768991388683709945} - component: {fileID: 8768991388683709945}
- component: {fileID: 8768991388683709948} - component: {fileID: 8768991388683709948}
- component: {fileID: 7821003709828495146}
- component: {fileID: 8066117290360009672}
m_Layer: 0 m_Layer: 0
m_Name: Platform_yellow m_Name: Platform_yellow
m_TagString: platform m_TagString: platform
@ -27,7 +29,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947} m_GameObject: {fileID: 8768991388683709947}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -92.17318, y: -60.5, z: -48.028496} m_LocalPosition: {x: -92.17318, y: -60.5, z: -48.028496}
m_LocalScale: {x: 6.7204876, y: 1.5078, z: 16.238924} m_LocalScale: {x: 6.7204876, y: 1.5078, z: 16.238924}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -114,3 +116,29 @@ MonoBehaviour:
renderer: {fileID: 8768991388683709950} renderer: {fileID: 8768991388683709950}
emissionUp: 1 emissionUp: 1
emmisionStepChange: 20 emmisionStepChange: 20
--- !u!114 &7821003709828495146
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fdc803964e5f2b042bece1765b69164f, type: 3}
m_Name:
m_EditorClassIdentifier:
type: 2
--- !u!65 &8066117290360009672
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 1, z: 0}

View File

@ -4998,6 +4998,7 @@ MonoBehaviour:
playerCamera: {fileID: 3244356567913423211} playerCamera: {fileID: 3244356567913423211}
runningParticles: {fileID: 1608137079} runningParticles: {fileID: 1608137079}
rotationX: 0 rotationX: 0
mainObject: {fileID: 3244356567786994345}
jump: {x: 0, y: 2, z: 0} jump: {x: 0, y: 2, z: 0}
jumpForce: 2 jumpForce: 2
isRunning: 0 isRunning: 0

View File

@ -13,6 +13,7 @@ public class PlayerController : MonoBehaviour
public ParticleSystem runningParticles; public ParticleSystem runningParticles;
Vector3 moveDirection = Vector3.zero; Vector3 moveDirection = Vector3.zero;
public float rotationX = 0; public float rotationX = 0;
public Transform mainObject;
// Start is called before the first frame update // Start is called before the first frame update
[HideInInspector] [HideInInspector]
bool canMove = true; bool canMove = true;
@ -23,6 +24,8 @@ public class PlayerController : MonoBehaviour
private bool isGoundet = false; private bool isGoundet = false;
public bool isRunning = false; public bool isRunning = false;
private Vector3 follow = Vector3.zero;
void Start() void Start()
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
@ -64,35 +67,39 @@ public class PlayerController : MonoBehaviour
rb.MovePosition(rb.position + moveDirection); rb.MovePosition(rb.position + moveDirection);
} }
void OnCollisionEnter(Collision other) void OnCollisionStay(Collision other)
{ {
isGoundet = true; isGoundet = true;
if (other.gameObject.tag == "platform") if (other.gameObject.tag == "platform")
{ {
var thisTransform = this.gameObject.transform;
Vector3 axis; Vector3 axis;
float angle; float angle;
axis = Vector3.Cross(-transform.up, -other.transform.up); axis = Vector3.Cross(-transform.up, -other.GetContact(0).normal);
if (axis != Vector3.zero) if (axis != Vector3.zero)
{ {
angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.transform.up)); angle = Mathf.Atan2(Vector3.Magnitude(axis), Vector3.Dot(-transform.up, -other.GetContact(0).normal));
transform.RotateAround(axis, angle); transform.RotateAround(axis, angle);
} }
Vector3 gDirection; Vector3 gDirection;
PlatformManager platform = other.gameObject.GetComponent<PlatformManager>(); PlatformManager platform = other.gameObject.GetComponent<PlatformManager>();
if (platform != null && platform.type == PlatformManager.PlatformType.Pull) if (platform != null && platform.type == PlatformManager.PlatformType.Pull)
{ {
gDirection = new Quaternion(0.0f, 0.0f, other.gameObject.transform.rotation.z, 1.0f) * Vector3.down; gDirection = -transform.up;
} }
else if (platform != null && platform.type == PlatformManager.PlatformType.Push) else if (platform != null && platform.type == PlatformManager.PlatformType.Push)
{ {
gDirection = new Quaternion(0.0f, 0.0f, other.gameObject.transform.rotation.z, 1.0f) * Vector3.up; gDirection = transform.up;
}
else if (platform != null && (platform.type == PlatformManager.PlatformType.RotateY || platform.type == PlatformManager.PlatformType.RotateZ))
{
gDirection = -transform.up;
} }
else else
{ {
gDirection = new Quaternion(0.0f, 0.0f, other.gameObject.transform.rotation.z, 1.0f) * Vector3.down; gDirection = -transform.up;
} }
Physics.gravity = gDirection * 9.81f; Physics.gravity = gDirection * 9.81f;