Beispiel #1
0
        public MainGameScene(Game game) : base(game)
        {
            this.switcher.AddScene(this);

            this.collection = new EntityCollection();
            this.alienWave  = new AlienWave(this.collection);

            Brick.DrawTexture   = this.Content.Load <Texture2D>("Textures/Pixel");
            Projectile.Texture  = this.Content.Load <Texture2D>("Textures/Projectile_16");
            Alien.TextureSmall  = this.Content.Load <Texture2D>("Textures/Alien_24_AA");
            Alien.TextureMedium = this.Content.Load <Texture2D>("Textures/Alien_28_AA");
            Alien.TextureLarge  = this.Content.Load <Texture2D>("Textures/Alien_32_AA");

            this.CreateGui();
        }
Beispiel #2
0
    private void CreateAndSavePrefab(int size)
    {
        ProgramEntry[] mProgramEntries =
        {
            ProgramEntryWave1,
            ProgramEntryWave2,
            ProgramEntryWave3,
            ProgramEntryWave4,
            ProgramEntryWave5,
            ProgramEntryWave6,
            ProgramEntryWave7,
            ProgramEntryWave8,
            ProgramEntryWave9,
            ProgramEntryWave10,

            ProgramEntryWave11,
            ProgramEntryWave12,
            ProgramEntryWave13,
            ProgramEntryWave14,
            ProgramEntryWave15,
            ProgramEntryWave16,
            ProgramEntryWave17,
            ProgramEntryWave18,
            ProgramEntryWave19,
            ProgramEntryWave20,

            ProgramEntryWave21,
            ProgramEntryWave22,
            ProgramEntryWave23,
            ProgramEntryWave24,
            ProgramEntryWave25,
            ProgramEntryWave26,
            ProgramEntryWave27,
            ProgramEntryWave28,
            ProgramEntryWave29,
            ProgramEntryWave30,

            ProgramEntryWave31,
            ProgramEntryWave32,
            ProgramEntryWave33,
            ProgramEntryWave34,
            ProgramEntryWave35,
            ProgramEntryWave36,
            ProgramEntryWave37,
            ProgramEntryWave38,
            ProgramEntryWave39,
            ProgramEntryWave40,

            ProgramEntryWave41,
            ProgramEntryWave42,
            ProgramEntryWave43,
            ProgramEntryWave44,
            ProgramEntryWave45,
            ProgramEntryWave46,
            ProgramEntryWave47,
            ProgramEntryWave48,
            ProgramEntryWave49,
            ProgramEntryWave50
        };

        GameObject objectPrefab = new GameObject(PrefabName);

        AlienWave scriptRef = objectPrefab.AddComponent <AlienWave>() as AlienWave;

        scriptRef.InitProgramEntries(size);

        for (int s = 0; s < size; s++)
        {
            scriptRef.AddProgramEntry(mProgramEntries[s]);
        }

        scriptRef.PrefabName   = PrefabName;
        scriptRef.NumWaves     = NumWaves;
        scriptRef.NumSquadsPer = NumSquadsPer;

        UnityEngine.Object prefab = PrefabUtility.CreateEmptyPrefab("Assets/Resources/Prefabs/Programs/" + objectPrefab.name + ".prefab");
        PrefabUtility.ReplacePrefab(objectPrefab, prefab, ReplacePrefabOptions.ConnectToPrefab);
    }