mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-04 01:49:07 +00:00
WERE FLYING IN DA AIR
This commit is contained in:
32
Assets/Scripts/GravityController.cs
Normal file
32
Assets/Scripts/GravityController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user