Complete speed platform
This commit is contained in:
@@ -6,6 +6,7 @@ public class PlatformManager : MonoBehaviour
|
||||
{
|
||||
public enum PlatformType {Pull, Push, RotateZ, RotateY, Speed};
|
||||
public PlatformType type = PlatformType.Pull;
|
||||
public float speed = 5;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -16,9 +17,9 @@ public class PlatformManager : MonoBehaviour
|
||||
{
|
||||
if (type == PlatformType.RotateZ)
|
||||
{
|
||||
transform.Rotate(transform.forward);
|
||||
transform.Rotate(transform.forward * speed * Time.deltaTime);
|
||||
} else if (type == PlatformType.RotateY) {
|
||||
transform.Rotate(transform.up);
|
||||
transform.Rotate(transform.up * speed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -97,6 +97,11 @@ public class PlayerController : MonoBehaviour
|
||||
{
|
||||
gDirection = -transform.up;
|
||||
}
|
||||
else if (platform != null && platform.type == PlatformManager.PlatformType.Speed)
|
||||
{
|
||||
rb.AddForce(other.transform.forward * platform.speed * 10 * Time.deltaTime, ForceMode.Impulse);
|
||||
gDirection = -transform.up;
|
||||
}
|
||||
else
|
||||
{
|
||||
gDirection = -transform.up;
|
||||
|
Reference in New Issue
Block a user