Movement Definition Creator Added
This commit is contained in:
@@ -135,14 +135,5 @@ namespace Syntriax.Modules.Movement.Config
|
||||
foreach (string monoBehaviours in definition.MonoBehaviours)
|
||||
MovementFactory.Instance.AddToGameObject(gameObject, monoBehaviours);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public static void SaveMovementDefinition(MovementDefinition definition)
|
||||
{
|
||||
string jsonText = JsonUtility.ToJson(definition, true);
|
||||
string path = $"Assets/Resources/{ResourceDirectoryToDefinitions}{definition.Name}.json";
|
||||
System.IO.File.WriteAllText(path, jsonText);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -67,17 +67,17 @@ namespace Syntriax.Modules.Movement.Config
|
||||
public Component AddToGameObject(GameObject gameObject, string name)
|
||||
{
|
||||
if (!Types.ContainsKey(name))
|
||||
throw new ArgumentException($"The key \"{ name }\" does not exists in the current { Name }");
|
||||
throw new ArgumentException($"The key \"{name}\" does not exists in the current {Name}");
|
||||
|
||||
return gameObject.AddComponent(Types[name]);
|
||||
}
|
||||
|
||||
public string GetTypeName(Type type)
|
||||
public static string GetTypeName(Type type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(type.Namespace))
|
||||
return type.Name;
|
||||
|
||||
return $"{ type.Namespace }.{ type.Name }";
|
||||
return $"{type.Namespace}.{type.Name}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user