Esempio n. 1
0
        void CreateNewStats()
        {
            var Stats = (AIStats[])Resources.FindObjectsOfTypeAll(typeof(AIStats));

            AIStats newStats = ScriptableObject.CreateInstance <AIStats>();

            if (AssetDatabase.GetMainAssetTypeAtPath(pathFolder + "/New  Stats.asset") != null)
            {
                AssetDatabase.CreateAsset(newStats, pathFolder + "/New  Stats" + Stats.Length.ToString() + ".asset");
            }

            else
            {
                AssetDatabase.CreateAsset(newStats, pathFolder + "/New  Stats.asset");
            }
        }
Esempio n. 2
0
        void BuildWindow(AIStats Stats)
        {
            if (Stats == null)
            {
                stats.Remove(Stats);
            }

            toggleField.alignment = TextAnchor.MiddleCenter;

            Repaint();

            if (selectionValue.ContainsKey(Stats))
            {
                GUILayout.BeginHorizontal();

                var previousName = Stats.name;

                var newName = GUILayout.TextField(Stats.name, GUILayout.Width(position.width / 8.5f));

                Stats.name = newName;

                if (previousName != Stats.name)
                {
                    AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(Stats), Stats.name);
                    stats.Clear();
                    SortLists();
                }

                Stats.dominance   = int.Parse(GUILayout.TextField(Stats.dominance.ToString(), GUILayout.Width(position.width / 9)));
                Stats.agression   = Mathf.Clamp(float.Parse(GUILayout.TextField(Stats.agression.ToString(), GUILayout.Width(position.width / 9))), 0, 99);
                Stats.attackSpeed = float.Parse(GUILayout.TextField(Stats.attackSpeed.ToString(), GUILayout.Width(position.width / 9)));
                Stats.power       = float.Parse(GUILayout.TextField(Stats.power.ToString(), GUILayout.Width(position.width / 9)));
                Stats.stamina     = float.Parse(GUILayout.TextField(Stats.stamina.ToString(), GUILayout.Width(position.width / 9)));
                Stats.stealthy    = GUILayout.Toggle(Stats.stealthy, Stats.stealthy.ToString(), GUILayout.Width(position.width / 9));
                Stats.toughness   = float.Parse(GUILayout.TextField(Stats.toughness.ToString(), GUILayout.Width(position.width / 9)));
                Stats.territorial = GUILayout.Toggle(Stats.territorial, Stats.territorial.ToString(), toggleField, GUILayout.Width(position.width / 9));
                GUILayout.EndHorizontal();
            }
        }