WERE FLYING IN DA AIR

This commit is contained in:
2025-03-28 14:53:19 +00:00
parent 01e700a00e
commit 6b565e5abc
3 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using UnityEngine;
public class GravityController
{
// The only instance of the class
static GravityController s_Instance = null;
// Constant gravity scale
const float m_GravityScale = 20.0f;
// Private constructor to stop accidental creation
private GravityController()
{ }
public static GravityController Instance()
{
// Creates an instance if there is not already one
if (s_Instance == null)
{
s_Instance = new GravityController();
}
// Returns the instance
return s_Instance;
}
public void SetScale(float scale)
{
// Sets the gravity
Physics.gravity = new Vector3(0, m_GravityScale * scale, 0);
}
}