예제 #1
0
    public static void CreateObject()
    {
        TrailDefinition asset = (TrailDefinition)ScriptableObject.CreateInstance(typeof(TrailDefinition));

        UnityEditor.AssetDatabase.CreateAsset(asset, "Assets/TrailDefinitions/New Trail.asset");
        UnityEditor.AssetDatabase.SaveAssets();

        UnityEditor.EditorUtility.FocusProjectWindow();

        UnityEditor.Selection.activeObject = asset;
    }
예제 #2
0
 public void BuyTrail(TrailDefinition trail)
 {
     if (GameManager.instance.credits >= trail.trailPrice)
     {
         GameManager.instance.credits     -= trail.trailPrice;
         GameManager.instance.currentTrail = GameManager.instance.trails.IndexOf(trail);
         trail.isBought = true;
         FindObjectOfType <MenuUIController> ().creditsText.text = GameManager.instance.credits.ToString("N0");
         UseTrail();
     }
     DataManager.SaveData();
 }