GGJ2022/Assets/Scripts/PlatformManager.cs

21 lines
587 B
C#
Raw Normal View History

2022-01-29 00:19:21 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformManager : MonoBehaviour
{
public enum PlatformType {Basic, Pull, Push, RotateZ, RotateY, SpeedUp, SpeedDown};
2022-01-29 00:19:21 +00:00
public PlatformType type = PlatformType.Pull;
2022-01-29 02:25:16 +00:00
public float speed = 5;
2022-01-29 00:19:21 +00:00
void FixedUpdate()
{
2022-01-29 00:47:41 +00:00
if (type == PlatformType.RotateZ)
2022-01-29 00:19:21 +00:00
{
2022-01-29 02:25:16 +00:00
transform.Rotate(transform.forward * speed * Time.deltaTime);
2022-01-29 00:47:41 +00:00
} else if (type == PlatformType.RotateY) {
2022-01-29 02:25:16 +00:00
transform.Rotate(transform.up * speed * Time.deltaTime);
2022-01-29 00:19:21 +00:00
}
}
}