Esempio n. 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.
        }
Esempio n. 2
0
    void Awake()
    {
        switch (PlayerPrefs.GetInt("Level"))
        {
            case 1:
                ground = new int[,]{
                    {1,1,1,1,1},
                    {1,0,0,9,1},
                    {1,1,0,0,1},
                    {0,1,0,1,1},
                    {8,1,1,1,0}
                };
                break;
            case 2:
                ground = new int[,]{
                    {9,1,0,0},
                    {0,1,1,1},
                    {0,0,0,1},
                    {8,1,1,1}
                };
                break;
            case 3:
                ground = new int[,]{
                    {1,1,1,9},
                    {1,0,0,1},
                    {1,0,0,1},
                    {8,1,1,1}
                };
                break;
            default:
            ground = new int[,]{
                {1,1,1,1,1},
                {1,0,1,0,1},
                {1,0,9,0,1},
                {1,0,0,1,1},
                {8,1,1,1,1}
            };
            break;
        }
        width = ground.GetLength(0);
        height = ground.GetLength(1);
        rueckweg = new int[width, height];

        map = new AssemblyCSharp.Map (ground, this);
        time = Time.time;
        mats = new Material[10];

        towerPlaced = new Tower[ground.Length, ground.GetLength (1)];
        for (int i = 0; i < ground.Length; i++) {
            for (int j = 0; j < ground.GetLength (1); j++){
                towerPlaced[i,j] = null;
            }
        }
    }
Esempio n. 3
0
 public BattleEvent(Unit one, Unit two,Map m)
 {
     attacker = one;
     attacked = two;
     map = m;
 }