Pit more versatile
This commit is contained in:
@@ -281,6 +281,7 @@ GameObject:
|
|||||||
- component: {fileID: 319279593}
|
- component: {fileID: 319279593}
|
||||||
- component: {fileID: 319279592}
|
- component: {fileID: 319279592}
|
||||||
- component: {fileID: 319279598}
|
- component: {fileID: 319279598}
|
||||||
|
- component: {fileID: 319279599}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: IceBlock
|
m_Name: IceBlock
|
||||||
m_TagString: IceBlock
|
m_TagString: IceBlock
|
||||||
@@ -423,7 +424,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 319279591}
|
m_GameObject: {fileID: 319279591}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 9.4, 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_LocalScale: {x: 2, y: 2, z: 2}
|
||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 1
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -442,7 +443,19 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush
|
m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush
|
||||||
contactForce: 4
|
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
|
--- !u!1 &330585543
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -882,6 +895,7 @@ GameObject:
|
|||||||
- component: {fileID: 955231356}
|
- component: {fileID: 955231356}
|
||||||
- component: {fileID: 955231355}
|
- component: {fileID: 955231355}
|
||||||
- component: {fileID: 955231360}
|
- component: {fileID: 955231360}
|
||||||
|
- component: {fileID: 955231361}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Penguin
|
m_Name: Penguin
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -1026,8 +1040,20 @@ MonoBehaviour:
|
|||||||
basespeed: 8
|
basespeed: 8
|
||||||
speed: 8
|
speed: 8
|
||||||
speedincrease: 0.05
|
speedincrease: 0.05
|
||||||
StartPos: {x: -15.5, y: 1.23, z: 12.73}
|
|
||||||
slide: 0.2
|
slide: 0.2
|
||||||
|
--- !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
|
--- !u!1 &1262927943
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -1092,8 +1118,6 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3}
|
m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::Pit
|
m_EditorClassIdentifier: Assembly-CSharp::Pit
|
||||||
player: {fileID: 955231360}
|
|
||||||
ice: {fileID: 319279598}
|
|
||||||
--- !u!4 &1604116872
|
--- !u!4 &1604116872
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ public class IceBlockPush : MonoBehaviour
|
|||||||
{
|
{
|
||||||
[SerializeField] float contactForce = 2.5f;
|
[SerializeField] float contactForce = 2.5f;
|
||||||
private Rigidbody rb;
|
private Rigidbody rb;
|
||||||
[SerializeField] private Vector3 StartPos;
|
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
@@ -35,9 +34,4 @@ public class IceBlockPush : MonoBehaviour
|
|||||||
|
|
||||||
rb.AddForce(directionVector * contactForce, ForceMode.Impulse);
|
rb.AddForce(directionVector * contactForce, ForceMode.Impulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
this.transform.position = StartPos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-21
@@ -3,28 +3,8 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class Pit : MonoBehaviour
|
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();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (other.GetComponent<PlayerMove>())
|
other.GetComponent<PositionReset>().Reset();
|
||||||
{
|
|
||||||
player.Reset();
|
|
||||||
}
|
|
||||||
else if(other.GetComponent<IceBlockPush>())
|
|
||||||
{
|
|
||||||
ice.Reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ public class PlayerMove : MonoBehaviour
|
|||||||
[SerializeField] private float speed;
|
[SerializeField] private float speed;
|
||||||
[SerializeField] private float speedincrease;
|
[SerializeField] private float speedincrease;
|
||||||
private Rigidbody rb;
|
private Rigidbody rb;
|
||||||
[SerializeField] private Vector3 StartPos;
|
|
||||||
[SerializeField] private float slide;
|
[SerializeField] private float slide;
|
||||||
|
|
||||||
Vector3 moveDirection;
|
Vector3 moveDirection;
|
||||||
@@ -67,10 +66,7 @@ public class PlayerMove : MonoBehaviour
|
|||||||
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
|
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
this.transform.position = StartPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator Slide(float delay)
|
IEnumerator Slide(float delay)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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