Ejemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 private static void Main(string[] args)
 {
     using (var game = new ShooterGame())
     {
         game.Run();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (ShooterGame game = new ShooterGame())
     {
         game.Run();
     }
 }
Ejemplo n.º 3
0
    public ShooterGameEditorTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Editor;

        ShooterGame.SetupISPCRules(this);

        ExtraModuleNames.Add("ShooterGame");
    }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            /*
             * In this example we are using .net event system to implement
             * observer pattern. Our bank account raises an event whenever it's balance
             * has changed so that external subscribers can react accordingly.
             * This method is very simple and has it's drawbacks - since this environment
             * is .net core, we are not able to use WeakEventManager which means subscribers
             * can cause memory leaks if they does not unsubscribe properly.
             */
            var ba = new BankAccount(100);

            ba.BalanceChanged += AccountBalanceUpdated;

            ba.Deposit(50);
            ba.Deposit(150);
            ba.BalanceChanged -= AccountBalanceUpdated;
            ba.Deposit(10);
            WriteLine(ba.Balance);

            /*
             * This example uses Reactive Extensions (Rx) library of .Net
             * and implements IObservable<T> and IObserver<T> to demonstrate
             * Observer pattern without events.
             */
            var shooter = new ShooterGame();
            var enemy1  = new Enemy("Enemy 1");
            var enemy2  = new Enemy("Enemy 2");

            shooter.AddEnemy(enemy1);
            shooter.AddEnemy(enemy2);

            enemy1.Fire();
            enemy2.Fire();
            shooter.RemoveSubscriptions();
            enemy1.Fire();

            /*
             * Rat game exercise
             */
            var game = new Game();
            var rat1 = new Rat(game);
            var rat2 = new Rat(game);

            WriteLine(rat1);
            WriteLine(rat2);
        }
Ejemplo n.º 5
0
    public ShooterGameTarget(TargetInfo Target) : base(Target)
    {
        Type       = TargetType.Game;
        bUsesSteam = true;

        ShooterGame.SetupISPCRules(this);

        ExtraModuleNames.Add("ShooterGame");

        if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            GlobalDefinitions.Add("GARLIC_HEAP_SIZE=(2600ULL * 1024 * 1024)");
            GlobalDefinitions.Add("ONION_HEAP_SIZE=(200ULL * 1024 * 1024)");
            GlobalDefinitions.Add("RESERVED_MEMORY_SIZE=(1ULL * 1024 * 1024)");
            GlobalDefinitions.Add("LIBC_MALLOC_SIZE=(32ULL * 1024 * 1024)");
            GlobalDefinitions.Add("LIBC_MALLOC_SIZE=(32ULL * 1024 * 1024)");

            //for a real game these could be behind a call to a virtual function defined in a partial class in a protected folder also.
            GlobalDefinitions.Add("UE4_PROJECT_NPTITLEID=NPXX51358_00");
            GlobalDefinitions.Add("UE4_PROJECT_NPTITLESECRET=81ae213eafbc64777574955bf921c9be3c60a3bddef70c357d8fe49ad64e0d0402d2249de390174832c5e4098114c93c33705b597cfbe9b1153d58fe9fae1f0de1466daf18ef25d06122cff7c95bde07bc060109e20c865305692dfbf9d7b726460893c4abd86dc9e8fd6b5db7dca4ffd4eefcb1771baccd576109bea862d6d4");
        }
    }
Ejemplo n.º 6
0
        public State(ShooterGame game, ContentManager content)
        {
            _game = game;

            _content = content;
        }
Ejemplo n.º 7
0
 public HighScoreState(ShooterGame g, ContentManager content)
     : base(g, content)
 {
 }
Ejemplo n.º 8
0
 public MenuState(ShooterGame game, ContentManager content)
     : base(game, content)
 {
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     Instance       = this;
     Time.timeScale = 0;
 }