예제 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(LevelManager lm)
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            pauseAction = new InputAction(
                new Buttons[] { Buttons.Start, Buttons.Back },
                new Keys[] { Keys.Escape },
                true);
            startAction = new InputAction(
                new Buttons[] { Buttons.A },
                new Keys[] { Keys.Enter },
                true);
            currentLevel = lm;
        }
예제 #2
0
        private List<Entity> GetSelections(LevelManager levelManager)
        {
            var selected = new List<Entity>();
            var entities = tilesOnly ? levelManager.Level.Tiles : levelManager.Level.Tiles.Concat(levelManager.Level.Entities);
            foreach (var entity in entities)
            {
                if (entity.Preview.Contains(
                        GetMousePosition(),
                        levelManager.RenderManager.TextureCache,
                        Camera.Transform))
                {
                    selected.Add(entity);
                }
            }

            return selected;
        }
예제 #3
0
파일: Trigger.cs 프로젝트: pquinn/time-sink
        public override void InitializePhysics(bool force, IComponentContext engineRegistrations)
        {
            if (force || !initialized)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;
                levelManager = engineRegistrations.Resolve<LevelManager>();
                engineGame = engineRegistrations.ResolveOptional<EngineGame>();

                Physics = BodyFactory.CreateRectangle(
                    world,
                    PhysicsConstants.PixelsToMeters(Width),
                    PhysicsConstants.PixelsToMeters(Height),
                    1,
                    Position,
                    this);
                Physics.BodyType = BodyType.Static;
                Physics.IsSensor = true;
                _geom = Physics.FixtureList;

                RegisterCollisions();

                initialized = true;
            }

            base.InitializePhysics(false, engineRegistrations);
        }
예제 #4
0
        public override void InitializePhysics(bool force, IComponentContext engineRegistrations)
        {
            if (force || !initialized)
            {
                var world = engineRegistrations.Resolve<PhysicsManager>().World;
                TurretPhysics = BodyFactory.CreateRectangle(
                    world,
                    PhysicsConstants.PixelsToMeters(TURRET_SIZE),
                    PhysicsConstants.PixelsToMeters(TURRET_SIZE),
                    1);

                levelManager = engineRegistrations.Resolve<LevelManager>();

            }

            base.InitializePhysics(force, engineRegistrations);
        }