Esempio n. 1
0
//
//		protected override void RegisterChildren(){
//			RegisterPlayers();
//			RegisterPhases();
//
//		}


//		void RegisterPlayers(){
//
//			CGM.Player[] children = (CGM.Player[])transform.GetComponentsInChildren<CGM.Player>();
//
//			//CGME.GameManager manager = CGME.GameManager.GetInstance();
//			foreach (CGM.Player child in children){
//				CGME_game.AddPlayer(child.CGME_Player);
//			}
//
//			Debug.Log ("Register players: " + CGME_game.Players_Size);
//
//		}


//		void RegisterPhases(){
//			foreach (CGM.Phase cgm_phase in Phases){
//				CGME_game.AddPhase(cgm_phase.CGME_Phase);
//			}
//
//			Debug.Log ("Register phases: " + CGME_game.Phases_Size);
//		}

        public void Register(CGMObject parent)
        {
            RegisterResources();

            for (int i = 0; i < transform.childCount; i++)
            {
                transform.GetChild(i).SendMessage("Register", this, SendMessageOptions.DontRequireReceiver);
            }

            SetListener();
        }
Esempio n. 2
0
        private Resource[] GetResourcesFrom(CGMObject source)
        {
            CGM.Resource[] resources = source.GetChildrenResources();

            if (resources == null)
            {
                Debug.Log("No resources");
                return(null);
            }

            return(resources);
        }
Esempio n. 3
0
        void TransferObjects(CGME.CGObject target, CGME.CGObject destination)
        {
            CGMObject cgm_target = FindObject(target);
            CGMObject cgm_dest   = FindObject(destination);

            if (cgm_target != null && cgm_dest != null)
            {
                //Debug.Log ("Transfering");
                cgm_target.gameObject.transform.parent = cgm_dest.transform;
                cgm_dest.Reposition();
            }
        }
Esempio n. 4
0
        void FocusObject(CGME.Actor act)
        {
            GameObject[] focus_objects = GameObject.FindGameObjectsWithTag("CGMFocus");

            foreach (GameObject focus in focus_objects)
            {
                CGMObject cgm_obj = focus.GetComponent <CGMObject>();
                if (cgm_obj != null)
                {
                    cgm_obj.CopyResources(act);
                }
            }
        }
Esempio n. 5
0
        private void DrawPopup(CGMObject psource, Vector3 position, CGME.ResourceAction[] action_list)
        {
            popup_source          = psource.GetCGMEActor();
            popup_res_action_list = action_list;

            string[] action_string_list = new string[action_list.Length];

            int i = 0;

            foreach (CGME.ResourceAction act in action_list)
            {
                action_string_list[i++] = act.CGType;
            }

            popup_window = new PopUpWindow(action_string_list, position);
        }