예제 #1
0
 void OnDisable()
 {
     if (s_instance == this)
     {
         s_instance = null;
     }
 }
예제 #2
0
 /// <summary>
 /// The main.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 private static void Main(string[] args)
 {
     using (var game = new ExampleGame(new ServerNetworkManager()))
     {
         game.Run();
     }
 }
예제 #3
0
 public override void Update()
 {
     base.Update();
     {
         // move
         Vector3 move_dir = Vector3.zero;
         move_dir.x       = Input.GetAxis("Horizontal");
         move_dir.y       = Input.GetAxis("Vertical");
         m_rigid.velocity = move_dir * m_move_speed;
     }
     {
         // look mouse cursor
         Ray   ray      = Camera.main.ScreenPointToRay(Input.mousePosition);
         Plane plane    = new Plane(new Vector3(0.0f, 0.0f, 1.0f), Vector3.zero);
         float distance = 0;
         if (plane.Raycast(ray, out distance))
         {
             m_rigid.rotation = Quaternion.LookRotation(ray.GetPoint(distance) - m_trans.position);
         }
         m_rigid.angularVelocity = Vector3.zero;
     }
     if (Input.GetButton("Fire1"))
     {
         ExampleBulletManager bm = ExampleGame.GetBulletManager();
         Vector3 center          = m_trans.position;
         Vector3 direction       = m_trans.forward;
         for (int i = 0; i < 32; ++i)
         {
             Vector3 pos = center + new Vector3(R(), R(), 0.0f).normalized *R() * 0.75f;
             bm.Shoot(pos, direction * 20.0f, 5.0f, m_bcol.m_id);
         }
     }
 }
예제 #4
0
 static void Main()
 {
     using (ExampleGame game = new ExampleGame())
     {
         game.Run();
     }
 }
예제 #5
0
 public static void Main(string[] args)
 {
     using (var game = new ExampleGame())
     {
         game.Run();
     }
 }
 /// <summary>
 /// Default Constructor 
 /// Sets the transition times as well as the viewports
 /// </summary>
 public GameplayScreen(ExampleGame game)
 {
     myGame = game;
     content = game.Content;
     TransitionOnTime = TimeSpan.FromSeconds(TRANSITION_ON_TIME);
     TransitionOffTime = TimeSpan.FromSeconds(TRANSITION_OFF_TIME);
     CameraController.Initialize(myGame);
     debugFont = game.Content.Load<SpriteFont>("debugFont");
 }
예제 #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var g = new ExampleGame();

            SetContentView((View)g.Services.GetService(typeof(View)));
            g.Run();
        }
예제 #8
0
        /// <summary>
        /// The main.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        private static void Main(string[] args)
        {
            Thread.Sleep(1000);

            using (var game = new ExampleGame(new ClientNetworkManager()))
            {
                game.Run();
            }
        }
예제 #9
0
    public override void OnLifeZero()
    {
        base.OnLifeZero();
        Vector3 pos     = m_trans.position;
        var     bullets = ExampleGame.GetBulletManager();

        for (int i = 0; i < 512; ++i)
        {
            Vector3 vel = new Vector3(R(), R(), 0.0f).normalized *(4.0f + R(1.5f));
            Vector3 rd  = new Vector3(R(), R(), 0.0f) * 0.5f;
            bullets.Shoot(pos + rd, vel);
        }
        Destroy(gameObject);
    }
예제 #10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();

            this.game = guppy
                        .ConfigureMonoGame(this.graphics, this.Content, this.Window)
                        .ConfigureTerminal()
                        .Initialize()
                        .BuildGame <ExampleGame>();
#if WINDOWS
            SDL_MaximizeWindow(Window.Handle);
#endif
        }
예제 #11
0
 public static void Main(string[] args)
 {
     var kernel = new StandardKernel();
     kernel.Load<ProtogameIoCModule>();
     kernel.Load<ProtogameAssetIoCModule>();
     kernel.Load<ProtogamePlatformingIoCModule>();
     kernel.Load<ProtogameLevelIoCModule>();
     kernel.Bind<ISolidEntity>().To<Solid>();
     kernel.Bind<ITileEntity>().To<Dirt>().Named("Dirt");
     AssetManagerClient.AcceptArgumentsAndSetup<LocalAssetManagerProvider>(kernel, args);
 
     using (var game = new ExampleGame(kernel))
     {
         game.Run();
     }
 }
예제 #12
0
 void OnEnable()
 {
     s_instance = this;
 }
예제 #13
0
 void OnEnable()
 {
     s_instance = this;
 }
예제 #14
0
 void OnDisable()
 {
     if (s_instance == this) s_instance = null;
 }
예제 #15
0
 void Start()
 {
     m_bullets = ExampleGame.GetBulletManager();
     GetComponent <BatchRendererInstance>().m_renderer = ExampleGame.GetSphereRenderer();
 }
예제 #16
0
 void Start()
 {
     m_rigid.velocity        = m_rigid.velocity + m_accel.normalized * 4.0f;
     m_rigid.angularVelocity = new Vector3(R(), R(), R());
     GetComponent <BatchRendererInstance>().m_renderer = ExampleGame.GetCubeRenderer();
 }