44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public static class GameData
|
|
{
|
|
public struct WeighedObject
|
|
{
|
|
public string name;
|
|
public float mass;
|
|
}
|
|
|
|
public struct MeasuredFriction
|
|
{
|
|
public string objectName;
|
|
public string surface;
|
|
public float mu;
|
|
public FrictionType frictionType;
|
|
}
|
|
|
|
public static List<WeighedObject> WeighedObjects = new();
|
|
public static List<MeasuredFriction> MeasuredFrictions = new();
|
|
|
|
public static void AddWeighed(string name, float mass)
|
|
{
|
|
foreach (var w in WeighedObjects)
|
|
if (w.name == name) return;
|
|
WeighedObjects.Add(new WeighedObject { name = name, mass = mass });
|
|
}
|
|
|
|
public static void AddFriction(string objName, string surface, float mu, FrictionType type)
|
|
{
|
|
foreach (var f in MeasuredFrictions)
|
|
if (f.objectName == objName && f.surface == surface && f.frictionType == type) return;
|
|
MeasuredFrictions.Add(new MeasuredFriction
|
|
{
|
|
objectName = objName,
|
|
surface = surface,
|
|
mu = mu,
|
|
frictionType = type
|
|
});
|
|
}
|
|
}
|