void OnEnable()
        {
            Target = (CGM.Resource)target;

            game = FindObjectOfType <CGM.Game>();
            if (game == null)
            {
                Debug.LogWarning("No Game component found");
                return;
            }

            manager = FindObjectOfType <CGM.GameManager>();
            if (manager == null)
            {
                Debug.LogWarning("No GameManager component found");
                return;
            }

            library = manager.CGME_Lib;

            phase_names.Clear();
            phase_names.Add("Any");
            phase_names.AddRange(game.GetPhases());
            res_string = "resource";

            if (library.resourceLibrary.Count == 0)
            {
                return;
            }

            if (Target.CGME_Resource == null)
            {
                Target.CGME_Resource = CGME.CGFactory.CreateCGInstance(library.GetResource(0).GetType().FullName) as CGME.Resource;
            }
        }
Exemple #2
0
        void Awake()
        {
            CGME_Manager = CGME.GameManager.GetInstance();

            CGME_Manager.AddEngineListener(this);
            CGME_Manager.AddActionEventListener(this);

            if (game_instance == null)
            {
                game_instance = FindObjectOfType <CGM.Game>();
            }

            Debug.Log("Adding actions to action library");
            foreach (ActionWrapper act in Actions)
            {
                cgme_lib.actionLibrary.Add(act.CGME_ActionRoot);
            }

            game_instance.Register(null);            //,SendMessageOptions.DontRequireReceiver);

            cam = FindObjectOfType <Camera>();

//			foreach (Action act in GetChildrenActions()){
//				cgme_lib.actionLibrary.Add (act.CGME_ActionRoot);
//			}
        }
Exemple #3
0
        void OnEnable()
        {
            Target = (CGM.Game)target;

//			foreach (CGM.Phase phase in Target.Phases){
//				expand.Add (false);
//			}
            //m_ShowExtraFields. = Repaint;
        }
Exemple #4
0
        void OnEnable()
        {
            Target = (CGM.GameManager)target;

            res_choice = 0;

            game     = FindObjectOfType <CGM.Game>();
            phases   = game.GetPhases();
            res_type = Display.ResourceTypes[res_choice];

            //actions = Target.GetChildrenActions();
            //action_string = new string[actions.Length];
            actions       = Target.Actions.ToArray();
            action_string = new string[actions.Length];

            int i = 0;

            foreach (CGM.ActionWrapper act in actions)
            {
                action_string[i++] = act.CGME_ActionRoot.CGType;
            }
        }
Exemple #5
0
        public override void OnInspectorGUI()
        {
            CGM.Game t = (CGM.Game)target;
            t.CGME_Game.CGType     = EditorGUILayout.TextField("Type", t.CGME_Game.CGType);
            Target.gameObject.name = t.CGME_Game.CGType;
            //CGM.Game
            //EditorGUILayout.LabelField("Phases");

//			for (int i = 0; i < Target.Phases.Count; i++){
//				DisplayPhase (Target, i);
//			}
//			if (GUILayout.Button("Add Phase")){
//				Target.Phases.Add (new CGM.Phase());
//				expand.Add (false);
//			}
//
//			source = (CGM.ActionBlock)EditorGUILayout.ObjectField(source,typeof(CGM.ActionBlock),true);
//
//			if (source is CGM.ActionBlock){
//				EditorGUILayout.LabelField("Action");
//			}
            //source = EditorGUILayout.ObjectField(source, typeof(CGM.ActionBlock), true);
        }