Implement Tara Changes
Made platforms prefabs Implemented platforms in default scene
This commit is contained in:
@@ -11,9 +11,9 @@ public class FallPlatform : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
rb = transform.parent.GetComponent<Rigidbody2D>();
|
||||
}
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (!falling && collision.gameObject.CompareTag("Player"))
|
||||
{
|
||||
|
||||
@@ -5,6 +5,10 @@ public class TeleportPlatform : MonoBehaviour
|
||||
public Vector2 teleportPoint;
|
||||
//public bool teleportPosition = false;
|
||||
public string teleportTag;
|
||||
public string playerTag = "Player";
|
||||
|
||||
|
||||
public bool isPlatform = true;
|
||||
|
||||
//private void Start()
|
||||
//{
|
||||
@@ -16,12 +20,26 @@ public class TeleportPlatform : MonoBehaviour
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag(teleportTag))
|
||||
if (!isPlatform)
|
||||
{
|
||||
transform.position = teleportPoint;
|
||||
if (TryGetComponent<Rigidbody2D>(out var rb))
|
||||
if (collision.CompareTag(teleportTag))
|
||||
{
|
||||
rb.linearVelocity = Vector2.zero;
|
||||
transform.position = teleportPoint;
|
||||
if (TryGetComponent<Rigidbody2D>(out var rb))
|
||||
{
|
||||
rb.linearVelocity = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (collision.CompareTag(playerTag))
|
||||
{
|
||||
collision.transform.position = teleportPoint;
|
||||
if (collision.TryGetComponent<Rigidbody2D>(out var rb))
|
||||
{
|
||||
rb.linearVelocity = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user