Пример #1
0
        /// <summary>
        /// Retrieve all the Manager and their data.
        /// If data is inexistant, create a new one.
        /// </summary>
        private static void Deserialize(WARGame WAR)
        {
            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type type in assembly.GetTypes())
                {
                    if (typeof(IManager).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        GameObject go = Resources.Load(PATH + type.Name) as GameObject;
                        if (go != null)
                        {
                            GameObject clone = Instantiate(go) as GameObject;
                            clone.name             = type.Name;
                            clone.transform.parent = Instance.gameObject.transform;

                            IManager manager = clone.GetComponent(type) as IManager;
                            if (manager != null)
                            {
                                RemoveExisting(type);
                                manager.Deserialize();
                                managers.Add(manager);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public void initBoard(UIPlane plane)
        {
            // create a new table with the given plane
            WARControlBoard.CreateTable(plane);

            // we're done with the setup mode so move to the deployment mode
            WARGame.SetMode(GAME_MODE.deployment);
        }
        public void nextPhase()
        {
            // move to the next phase of the game
            GAME_PHASE nextPhase = WARGame.Phase.Value.current + 1;
            var        phase     = GAME_PHASE.GetValues(typeof(GAME_PHASE)).Cast <GAME_PHASE>().Last();

            phase = nextPhase > phase ? default(GAME_PHASE) + 1 : nextPhase;
            WARGame.SetPhase(phase);
        }
Пример #4
0
        private void Start()
        {
            if (Instance != null)     // Frankly, this should not happen. Someone made an error otherwise.
            {
                Destroy(gameObject);
                return;
            }
            else
            {
                Instance = this;
            }

            Deserialize(this);
            DontDestroyOnLoad(gameObject);
        }
 // called when we move to the gameplay mode
 public void initMode(Epoch <GAME_MODE> modeEpoch)
 {
     // start in the movement phase
     WARGame.SetPhase(GAME_PHASE.movement);
 }