Compare commits
4 Commits
4a4e3be216
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 32fe394b58 | |||
| 3d964a33e1 | |||
| fe6821d986 | |||
| 968a095813 |
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ecf27f8ef94e904981b6ec7f5363702
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 140426efa0ba27942bd569222ed3a9f4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b37e6f7170b25c4db6a0c78dfa46e57
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -119,73 +119,6 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &67018399
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 67018400}
|
||||
- component: {fileID: 67018402}
|
||||
- component: {fileID: 67018401}
|
||||
m_Layer: 0
|
||||
m_Name: StandUpCollider
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &67018400
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 67018399}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 955231359}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &67018401
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 67018399}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 19aae932aa4446c4788d84deb1116128, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::StandUpCollider
|
||||
ispushing: 0
|
||||
--- !u!135 &67018402
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 67018399}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 1
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Radius: 2
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &209519236
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -348,7 +281,6 @@ GameObject:
|
||||
- component: {fileID: 319279593}
|
||||
- component: {fileID: 319279592}
|
||||
- component: {fileID: 319279598}
|
||||
- component: {fileID: 319279599}
|
||||
m_Layer: 0
|
||||
m_Name: IceBlock
|
||||
m_TagString: IceBlock
|
||||
@@ -491,7 +423,7 @@ Transform:
|
||||
m_GameObject: {fileID: 319279591}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -12.4, y: 1.51404, z: 15.37}
|
||||
m_LocalPosition: {x: -12.2, y: 1.51404, z: 15.37}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
@@ -510,19 +442,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush
|
||||
contactForce: 4
|
||||
--- !u!114 &319279599
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 319279591}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8fc662358fbf8394d804207b2a8c9868, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PositionReset
|
||||
StartPos: {x: 9.2, y: 1.51404, z: 15.37}
|
||||
StartPos: {x: 9.4, y: 1.51404, z: 15.37}
|
||||
--- !u!1 &330585543
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -962,7 +882,6 @@ GameObject:
|
||||
- component: {fileID: 955231356}
|
||||
- component: {fileID: 955231355}
|
||||
- component: {fileID: 955231360}
|
||||
- component: {fileID: 955231361}
|
||||
m_Layer: 0
|
||||
m_Name: Penguin
|
||||
m_TagString: Untagged
|
||||
@@ -1089,8 +1008,7 @@ Transform:
|
||||
m_LocalPosition: {x: -15.5, y: 1.23, z: 12.73}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 67018400}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &955231360
|
||||
@@ -1105,24 +1023,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 9b9bab48a629093449f53dc5ea63d752, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerMove
|
||||
basespeed: 8
|
||||
speed: 8
|
||||
speedincrease: 0.05
|
||||
maxspeed: 15
|
||||
slide: 0.2
|
||||
standUp: {fileID: 0}
|
||||
--- !u!114 &955231361
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 955231353}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8fc662358fbf8394d804207b2a8c9868, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PositionReset
|
||||
rb: {fileID: 0}
|
||||
StartPos: {x: -15.5, y: 1.23, z: 12.73}
|
||||
--- !u!1 &1262927943
|
||||
GameObject:
|
||||
@@ -1188,7 +1090,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Pit
|
||||
startmass: 0
|
||||
player: {fileID: 955231360}
|
||||
ice: {fileID: 319279598}
|
||||
--- !u!4 &1604116872
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1198,7 +1101,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1604116870}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2.3, y: -2.37, z: 13.1}
|
||||
m_LocalPosition: {x: -2.3, y: -0.7, z: 13.1}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
||||
@@ -5,6 +5,7 @@ public class IceBlockPush : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float contactForce = 2.5f;
|
||||
private Rigidbody rb;
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -34,4 +35,9 @@ public class IceBlockPush : MonoBehaviour
|
||||
|
||||
rb.AddForce(directionVector * contactForce, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.transform.position = StartPos;
|
||||
}
|
||||
}
|
||||
|
||||
+21
-7
@@ -1,16 +1,30 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class Pit : MonoBehaviour
|
||||
{
|
||||
public float startmass;
|
||||
public PlayerMove player;
|
||||
public IceBlockPush ice;
|
||||
//
|
||||
// // Update is called once per frame
|
||||
// void Update()
|
||||
// {
|
||||
// if (Input.GetKeyDown(KeyCode.Space))
|
||||
// {
|
||||
// player.Reset();
|
||||
// ice.Reset();
|
||||
// }
|
||||
// }
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.isTrigger) return;
|
||||
startmass = other.GetComponent<Rigidbody>().mass;
|
||||
other.GetComponent<Rigidbody>().mass = 100;
|
||||
other.GetComponent<Rigidbody>().mass = startmass;
|
||||
other.GetComponent<PositionReset>().Reset();
|
||||
if (other.GetComponent<PlayerMove>())
|
||||
{
|
||||
player.Reset();
|
||||
}
|
||||
else if(other.GetComponent<IceBlockPush>())
|
||||
{
|
||||
ice.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float basespeed;
|
||||
[SerializeField] private float speed;
|
||||
[SerializeField] private float speedincrease;
|
||||
[SerializeField] private float maxspeed;
|
||||
|
||||
private Rigidbody rb;
|
||||
[SerializeField] private float slide;
|
||||
|
||||
Vector3 moveDirection;
|
||||
[SerializeField] private Rigidbody rb;
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
|
||||
bool vertical;
|
||||
private bool horizontal;
|
||||
|
||||
[SerializeField] private StandUpCollider standUp;
|
||||
|
||||
bool horizontal;
|
||||
private void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
standUp = FindAnyObjectByType(typeof(StandUpCollider)) as StandUpCollider;
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -33,44 +21,26 @@ public class PlayerMove : MonoBehaviour
|
||||
horizontalInput = Mathf.Round(horizontalInput);
|
||||
verticalInput = Mathf.Round(verticalInput);
|
||||
|
||||
|
||||
Vector3 moveDirection;
|
||||
|
||||
if (horizontalInput != 0 && horizontal == true)
|
||||
{
|
||||
if (!standUp.ispushing)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, 90f);
|
||||
}
|
||||
vertical = false;
|
||||
moveDirection = new Vector3(horizontalInput,0, 0);
|
||||
moveDirection.Normalize();
|
||||
|
||||
if (!vertical && speed <= maxspeed && !standUp.ispushing)
|
||||
{
|
||||
speed += speedincrease;
|
||||
}
|
||||
|
||||
}
|
||||
else if (verticalInput != 0 && vertical == true)
|
||||
{
|
||||
if (!standUp.ispushing)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(90f, 0f, 0f);
|
||||
}
|
||||
horizontal = false;
|
||||
moveDirection = new Vector3(0, 0, verticalInput);
|
||||
moveDirection.Normalize();
|
||||
|
||||
if (!horizontal && speed <= maxspeed && !standUp.ispushing)
|
||||
{
|
||||
speed += speedincrease;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCoroutine(Slide(slide));
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, 0f);
|
||||
|
||||
moveDirection = new Vector3(0, 0, 0);
|
||||
horizontal = true;
|
||||
vertical = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,19 +48,8 @@ public class PlayerMove : MonoBehaviour
|
||||
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
|
||||
}
|
||||
|
||||
|
||||
|
||||
IEnumerator Slide(float delay)
|
||||
public void Reset()
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
moveDirection = new Vector3(0, 0, 0);
|
||||
horizontal = true;
|
||||
vertical = true;
|
||||
speed = basespeed;
|
||||
|
||||
this.transform.position = StartPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class StandUpCollider : MonoBehaviour
|
||||
{
|
||||
public bool ispushing;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
IceBlockPush block = other.gameObject.GetComponent<IceBlockPush>();
|
||||
if (block != null)
|
||||
{
|
||||
ispushing = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
{
|
||||
IceBlockPush block = other.gameObject.GetComponent<IceBlockPush>();
|
||||
if (block != null)
|
||||
{
|
||||
ispushing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19aae932aa4446c4788d84deb1116128
|
||||
@@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PositionReset : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.transform.position = StartPos;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fc662358fbf8394d804207b2a8c9868
|
||||
Reference in New Issue
Block a user