Compare commits
6 Commits
master
...
4a4e3be216
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a4e3be216 | |||
| 3257f23245 | |||
| 9c1ac2c040 | |||
| 2668c0774e | |||
| 2d93071bfc | |||
| 521c86dbd4 |
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ecf27f8ef94e904981b6ec7f5363702
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 140426efa0ba27942bd569222ed3a9f4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b37e6f7170b25c4db6a0c78dfa46e57
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -119,6 +119,73 @@ 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
|
||||
@@ -281,6 +348,7 @@ GameObject:
|
||||
- component: {fileID: 319279593}
|
||||
- component: {fileID: 319279592}
|
||||
- component: {fileID: 319279598}
|
||||
- component: {fileID: 319279599}
|
||||
m_Layer: 0
|
||||
m_Name: IceBlock
|
||||
m_TagString: IceBlock
|
||||
@@ -423,7 +491,7 @@ Transform:
|
||||
m_GameObject: {fileID: 319279591}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -12.2, y: 1.51404, z: 15.37}
|
||||
m_LocalPosition: {x: -12.4, y: 1.51404, z: 15.37}
|
||||
m_LocalScale: {x: 2, y: 2, z: 2}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
@@ -442,7 +510,19 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush
|
||||
contactForce: 4
|
||||
StartPos: {x: 9.4, y: 1.51404, z: 15.37}
|
||||
--- !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}
|
||||
--- !u!1 &330585543
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -882,6 +962,7 @@ GameObject:
|
||||
- component: {fileID: 955231356}
|
||||
- component: {fileID: 955231355}
|
||||
- component: {fileID: 955231360}
|
||||
- component: {fileID: 955231361}
|
||||
m_Layer: 0
|
||||
m_Name: Penguin
|
||||
m_TagString: Untagged
|
||||
@@ -1008,7 +1089,8 @@ 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: []
|
||||
m_Children:
|
||||
- {fileID: 67018400}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &955231360
|
||||
@@ -1023,8 +1105,24 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 9b9bab48a629093449f53dc5ea63d752, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerMove
|
||||
basespeed: 8
|
||||
speed: 8
|
||||
rb: {fileID: 0}
|
||||
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
|
||||
StartPos: {x: -15.5, y: 1.23, z: 12.73}
|
||||
--- !u!1 &1262927943
|
||||
GameObject:
|
||||
@@ -1090,8 +1188,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Pit
|
||||
player: {fileID: 955231360}
|
||||
ice: {fileID: 319279598}
|
||||
startmass: 0
|
||||
--- !u!4 &1604116872
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1101,7 +1198,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1604116870}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2.3, y: -0.7, z: 13.1}
|
||||
m_LocalPosition: {x: -2.3, y: -2.37, z: 13.1}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
||||
@@ -5,7 +5,6 @@ public class IceBlockPush : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float contactForce = 2.5f;
|
||||
private Rigidbody rb;
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -35,9 +34,4 @@ public class IceBlockPush : MonoBehaviour
|
||||
|
||||
rb.AddForce(directionVector * contactForce, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.transform.position = StartPos;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-21
@@ -1,30 +1,16 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class Pit : MonoBehaviour
|
||||
{
|
||||
public PlayerMove player;
|
||||
public IceBlockPush ice;
|
||||
//
|
||||
// // Update is called once per frame
|
||||
// void Update()
|
||||
// {
|
||||
// if (Input.GetKeyDown(KeyCode.Space))
|
||||
// {
|
||||
// player.Reset();
|
||||
// ice.Reset();
|
||||
// }
|
||||
// }
|
||||
|
||||
public float startmass;
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.GetComponent<PlayerMove>())
|
||||
{
|
||||
player.Reset();
|
||||
}
|
||||
else if(other.GetComponent<IceBlockPush>())
|
||||
{
|
||||
ice.Reset();
|
||||
}
|
||||
if (other.isTrigger) return;
|
||||
startmass = other.GetComponent<Rigidbody>().mass;
|
||||
other.GetComponent<Rigidbody>().mass = 100;
|
||||
other.GetComponent<Rigidbody>().mass = startmass;
|
||||
other.GetComponent<PositionReset>().Reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMove : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float basespeed;
|
||||
[SerializeField] private float speed;
|
||||
[SerializeField] private Rigidbody rb;
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
[SerializeField] private float speedincrease;
|
||||
[SerializeField] private float maxspeed;
|
||||
|
||||
private Rigidbody rb;
|
||||
[SerializeField] private float slide;
|
||||
|
||||
Vector3 moveDirection;
|
||||
|
||||
bool vertical;
|
||||
bool horizontal;
|
||||
private bool horizontal;
|
||||
|
||||
[SerializeField] private StandUpCollider standUp;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody>();
|
||||
standUp = FindAnyObjectByType(typeof(StandUpCollider)) as StandUpCollider;
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -21,26 +33,44 @@ 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
|
||||
{
|
||||
moveDirection = new Vector3(0, 0, 0);
|
||||
horizontal = true;
|
||||
vertical = true;
|
||||
StartCoroutine(Slide(slide));
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, 0f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +78,19 @@ public class PlayerMove : MonoBehaviour
|
||||
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
||||
|
||||
IEnumerator Slide(float delay)
|
||||
{
|
||||
this.transform.position = StartPos;
|
||||
yield return new WaitForSeconds(delay);
|
||||
moveDirection = new Vector3(0, 0, 0);
|
||||
horizontal = true;
|
||||
vertical = true;
|
||||
speed = basespeed;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19aae932aa4446c4788d84deb1116128
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PositionReset : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Vector3 StartPos;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
this.transform.position = StartPos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fc662358fbf8394d804207b2a8c9868
|
||||
Reference in New Issue
Block a user