public void Start() { _controller = GetComponent <CharacterController>(); _sprite = GetComponentInChildren <SpriteSystem>(); _lastDirection = DownPart; }
protected override void Update(GameTime gameTime) { //Console.Log(IsLoaded); if (!GameContent.IsLoaded) { //Console.Log("loading"); base.Update(gameTime); return; } //Update KeyboardController for Commands keyboard.Update(); Input.GetState(); // Game implemented using Entity-Component-System, // Systems store instances of certain types of Components TransformSystem.Update(gameTime); BehaviorScriptSystem.Update(gameTime); ColliderSystem.Update(gameTime); ColliderSystem.Check(); SpriteSystem.Update(gameTime); TextSystem.Update(gameTime); //Sound.Update(gameTime); base.Update(gameTime); }
public void Start() { _controller = GetComponent<CharacterController>(); _sprite = GetComponentInChildren<SpriteSystem>(); _lastDirection = DownPart; }
public TestState(string name) : base(name) { entityManager = new EntityManager(); systemManager = new SystemManager(); spriteSystem = new SpriteSystem(); line2DSystem = new Line2DSystem(); text2DSystem = new Text2DSystem(); }
public UITestState(string name) : base(name) { entityManager = new EntityManager(); systemManager = new SystemManager(); text2DSystem = new Text2DSystem(); spriteSystem = new SpriteSystem(); buttonSystem = new ButtonSystem(); }
protected override void Draw(GameTime gameTime) { if (gameTime.TotalGameTime.Seconds > _lastTime) { _lastTime = gameTime.TotalGameTime.Seconds; frame = frameCounter; frameCounter = 0; } frameCounter++; if (!GameContent.IsLoaded) { GraphicsDevice.Clear(Color.CornflowerBlue); if (GameContent.IsBaseLoaded) { var size = GameContent.Font.hudFont.MeasureString("Click on game area to start it!"); spriteBatch.Begin(); if (!GameContent.IsLoaded) { spriteBatch.DrawString(GameContent.Font.hudFont, "Zelda is loading: " + GameContent.Counter + " / " + GameContent.Max, new Vector2(20, 440 - size.Y - 10), Color.White, 0f, Vector2.Zero, .5f, SpriteEffects.None, 1f); //spriteBatch.Draw(GameContent.Texture.Pixel, new Rectangle(20, 440, (int)(760 * (GameContent.Counter / (float)GameContent.Max)), 20), Color.White); } spriteBatch.End(); } base.Draw(gameTime); return; } GraphicsDevice.Clear(Color.IndianRed); spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp); SpriteSystem.Draw(spriteBatch); // Draw all Sprite components ColliderSystem.Draw(spriteBatch); // Draw all Collider debug boxes TextSystem.Draw(spriteBatch); // Draw all Text components if (LevelManager.showFPS) { DrawShadowedString(GameContent.Font.hudFont, "FPS: " + frame, new Vector2(440f, 20f), Color.Yellow); } spriteBatch.End(); base.Draw(gameTime); }
public CargoShuttleMenu(IGameTiming timing, IPrototypeManager protoManager, SpriteSystem spriteSystem) { RobustXamlLoader.Load(this); _timing = timing; _protoManager = protoManager; _spriteSystem = spriteSystem; ShuttleCallButton.OnPressed += OnCallPressed; ShuttleRecallButton.OnPressed += OnRecallPressed; Title = Loc.GetString("cargo-shuttle-console-menu-title"); }
protected override void UnloadContent() { Content.Unload(); // We need to clear all our components to reset state; If the program is reset they will be created fresh by the new Link() instance TransformSystem.Clear(); ColliderSystem.Clear(); BehaviorScriptSystem.Clear(); SpriteSystem.Clear(); TextSystem.Clear(); Scene.Clear(); }
public void Start() { _movement = GetComponent<SidescrollingMovement>(); _sprite = GetComponentInChildren<SpriteSystem>(); _sense = GetComponentInChildren<PlayerSense>(); List<State> machineStates = new List<State>{ new State{Condition = () => true, Behavior = Patrol}, new State{Condition = SensePlayer, Behavior = FightOrFlight}, new State{Condition = IsHit, Behavior = BeHit} }; _states = new StateMachine(machineStates); }
public DecalOverlay( DecalSystem decals, SharedTransformSystem transforms, SpriteSystem sprites, IEntityManager entManager, IMapManager mapManager, IPrototypeManager prototypeManager) { _decals = decals; _transform = transforms; _sprites = sprites; _entManager = entManager; _mapManager = mapManager; _prototypeManager = prototypeManager; }
public void Destroy() { foreach (var transform in Root.GetComponent <Transform>().Children) { Entity entity = transform.entity; if (entity != null) { Entity.Destroy(entity); } } Root.GetComponent <Transform>().Children.Clear(); TransformSystem.CleanUp(); ColliderSystem.CleanUp(); BehaviorScriptSystem.CleanUp(); SpriteSystem.CleanUp(); }
public GameSystemLoader(EntityWorld world, // Single LoadButtonConfigurationSystem loadButtonConfigurationSystem, // Update GravitySystem gravitySystem, PhysicsSystem physicsSystem, PlayerStateSystem playerStateSystem, EntityCollisionSystem entityCollisionSystem, LevelCollisionSystem levelCollisionSystem, CameraSystem cameraSystem, SpriteSystem spriteSystem, HeartbeatSystem heartbeatSystem, DebugSystem debugSystem, DebugTextSystem debugTextSystem, // Draw RenderSystem renderSystem, RenderLevelSystem renderLevelSystem, RenderCollisionBoxSystem renderCollisionBoxSystem, RenderTextSystem renderTextSystem, RenderStaticGraphicSystem renderStaticGraphicSystem, RenderLifeBarSystem renderLifeBarSystem) : base(world) { // Single _loadButtonConfigurationSystem = loadButtonConfigurationSystem; // Update _gravitySystem = gravitySystem; _physicsSystem = physicsSystem; _playerStateSystem = playerStateSystem; _entityCollisionSystem = entityCollisionSystem; _levelCollisionSystem = levelCollisionSystem; _cameraSystem = cameraSystem; _spriteSystem = spriteSystem; _heartbeatSystem = heartbeatSystem; _debugSystem = debugSystem; _debugTextSystem = debugTextSystem; // Draw _renderSystem = renderSystem; _renderLevelSystem = renderLevelSystem; _renderCollisionBoxSystem = renderCollisionBoxSystem; _renderTextSystem = renderTextSystem; _renderStaticGraphicSystem = renderStaticGraphicSystem; _renderLifeBarSystem = renderLifeBarSystem; }
public EditorSystemLoader(EntityWorld world, // Update SpriteSystem spriteSystem, HighlightedTileSystem highlightedTileSystem, // Draw RenderSystem renderSystem, RenderLevelSystem renderLevelSystem, RenderTextSystem renderTextSystem, RenderStaticGraphicSystem renderStaticGraphicSystem, RenderHighlightedTile renderHighlightedTile) : base(world) { // Update _spriteSystem = spriteSystem; _highlightedTileSystem = highlightedTileSystem; // Draw _renderSystem = renderSystem; _renderLevelSystem = renderLevelSystem; _renderTextSystem = renderTextSystem; _renderStaticGraphicSystem = renderStaticGraphicSystem; _renderHighlightedTile = renderHighlightedTile; }
void Start() { _snout = GetComponentInChildren<ProjectileProjector>(); _movement = GetComponent<SidescrollingMovement>(); _sprite = GetComponentInChildren<SpriteSystem>(); List<State> states = new List<State> { new State{ Condition = () => true, Behavior = DoNothing }, new State{ Condition = PlayerNearby, Behavior = ChooseAction }, new State{ Condition = IsHit, Behavior = DoNothing } }; _fsm = new StateMachine(states); }
// Use this for initialization void Start() { _originalPosition = transform.position; _movement = GetComponent<SidescrollingMovement>(); _animation = GetComponentInChildren<SpriteSystem>(); _hitboxes = GetComponentInChildren<HitboxController>(); _sense = GetComponentInChildren<PlayerSense>(); _states = new StateMachine(new List<State> { new State {Condition = DefaultCondition, Behavior = GuardOriginalPosition}, new State {Condition = SeesPlayer, Behavior = MoveTowardPlayer}, new State {Condition = InRange, Behavior = FenceWithPlayer}, new State {Condition = PlayerIsJumping, Behavior = MoveTowardPlayer}, new State {Condition = IsHit, Behavior = BeHit} }); }
public void Start() { _control = GetComponent <PlayerControl>(); _animation = GetComponentInChildren <SpriteSystem>(); _hitboxController = gameObject.GetComponentInChildren <HitboxController>(); }
// implementation of a Collider component public Sprite() { SpriteSystem.Register(this); }
// Use this for initialization protected void Start() { _sense = GetComponentInChildren<PlayerSense>(); _sprite = GetComponentInChildren<SpriteSystem>(); _projector = GetComponentInChildren<ProjectileProjector>(); _webThread = GetComponent<LineRenderer>(); _controller = GetComponent<CharacterController>(); _behaviorFSM = new StateMachine(new List<State> { new State { Condition = DefaultCondition, Behavior = DoNothing}, new State { Condition = SensesPlayer, Behavior = MoveTowardPlayer }, new State { Condition = IsOverPlayer, Behavior = Attack }, new State { Condition = AttackingTarget, Behavior = VerticalGrappling } }); }
public void Update(float gameTime) { TransformSystem.Update(gameTime); SpriteSystem.Update(gameTime); ColliderSystem.Update(gameTime); }
public void Start() { _sense = GetComponentInChildren <PlayerSense>(); _sprite = GetComponentInChildren <SpriteSystem>(); }
public Sprite(BasicSprite givenSprite = null) { SpriteSystem.Register(this); sprite = givenSprite; }
public void Start() { _movement = gameObject.GetComponent<SidescrollingMovement>(); _animation = gameObject.GetComponentInChildren<SpriteSystem>(); _hitboxController = gameObject.GetComponentInChildren<HitboxController>(); }