Пример #1
0
        // when the program launches, Grid will check that all the needed elements are in place
        // that's exactly what you do in the static constructor here:
        static Grid()
        {
            GameObject g;

            g = safeFind("Map");
            map = (Map)SafeComponent(g,"Map");

            g = safeFind("Controller");
            controller = (Controller)SafeComponent(g,"Controller");

            g = safeFind("Camera");
            camera = (Camera)SafeComponent(g,"Camera");

            g = safeFind("Turn Manager");
            turnManager = (TurnManager)SafeComponent(g,"TurnManager");

            g = safeFind("Game State");
            gameState = (GameState)SafeComponent(g,"GameState");

            g = safeFind("Prefab Loader");
            prefabLoader = (PrefabLoader)SafeComponent(g,"PrefabLoader");

            // PS. annoying arcane technical note - remember that really, in c# static constructors do not run
            // until the FIRST TIME YOU USE THEM.  almost certainly in any large project like this, Grid
            // would be called zillions of times by all the Awake (etc etc) code everywhere, so it is
            // a non-issue. but if you're just testing or something, it may be confusing that (for example)
            // the wake-up alert only appears just before you happen to use Grid, rather than "when you hit play"
            // you may want to call "SayHello" from the GeneralOperations.cs, just to decisively start this script.
        }
Пример #2
0
 public PlayerFaction()
     : base()
 {
     spells = new List<Action>();
             spells.Add(new Ping());
             controller = Grid.controller;
             phases = new List<Phase>();
             skillPhase = new SkillPhase();
             phases.Add(skillPhase);//may need to make an attribute to keep track of the skill phase so it can show what skill you will get.
             phases.Add (new BuildPhase());
             discoveredBuildings = new List<BuildingEffect>();
     //phases.Add(new SkillPhase());
 }