1
0
This repository has been archived on 2024-09-03. You can view files and clone it, but cannot push or open issues or pull requests.
System-Purge/Assets/Resources/Scripts/Utilities.cs

53 lines
1.3 KiB
C#
Raw Normal View History

2016-01-29 21:44:30 -05:00
using UnityEngine;
using System.Collections;
using System;
2016-01-29 21:44:30 -05:00
/// <summary>
/// This will store away all of our utility functions during this little game jam of mine.
/// </summary>
namespace GameUtils
2016-01-29 21:44:30 -05:00
{
/// <summary>
/// Collision point class containing relevant collision data: point(world space), contact normal, intensity (how hard?)
/// </summary>
public class CollisionPoint : IComparable<CollisionPoint>
{
public Vector3 point, normal;
public float intensity;
public int CompareTo(CollisionPoint other)
{
// Sort by whichever contact normal is closest to pointing straight up.
return Vector3.Angle(normal, Vector3.up).CompareTo(Vector3.Angle(other.normal, Vector3.up));
}
}
2016-01-29 21:44:30 -05:00
public interface ISceneObject
{
void ObjectUpdate();
void Initialize();
2016-01-29 21:44:30 -05:00
}
public enum GameInput
{
JUMP // Add more as needed
}
2016-01-29 21:44:30 -05:00
public static class Utilities
{
public static Vector2 Vec2(Vector3 input)
{
return new Vector2(input.x, input.y);
}
}
2016-01-29 21:44:30 -05:00
// Game State Enumerator
public enum GameState
{
TITLE, // index 0
MAINMENU // index 1
// ... this goes on to define levels, most useful if kept in the same loading order that is to be used during build.
2016-01-29 21:44:30 -05:00
}
}