Example #1
0
    // *** Main Initializer ***
    void Awake()
    {
        myTrans = transform;
        cam     = Camera.main;
        if (Camera.main)
        {
            zoneCameraControls = Camera.main.GetComponent <ZoneViewCamera>();
        }

        // @TODO: Make these a singleton pattern
        //currentZone = new Zone(1); // Required so Hex doesn't null ref currentZone
        Hex.Initialize();

        // Ideally, the only place state is manually set.
        state = beginningState;
        bool loading;

        switch (state)
        {
        case RelativityState.WorldDuel:
            loading = false; //@TODO: still caching on duel
            InitializeWorld(loading);

            InitializeCombat();
            combatManager.BeginDuel();
            break;

        case RelativityState.WorldMap:
            loading = true;
            InitializeWorld(loading);
            break;

        case RelativityState.ZoneMap:
            InitializeZone();
            break;

        case RelativityState.Caching:
            Debug.Log("got to game manager caching");
            loading = false;
            InitializeWorld(loading);
            Debug.Log("advanced past initialize");
            worldCacher = worldManagerObj.GetComponent <CreateWorldCache>();
            worldCacher.BuildCache(worldManager.activeWorld);
            break;

        default:
            Debug.LogError("Please set a state in GameManager.beginningState before playing.");
            break;
        }
    }