Beispiel #1
0
    public void Start()
    {
        _controller = GetComponent <CharacterController>();
        _sprite     = GetComponentInChildren <SpriteSystem>();

        _lastDirection = DownPart;
    }
Beispiel #2
0
        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;
    }
Beispiel #4
0
 public TestState(string name) : base(name)
 {
     entityManager = new EntityManager();
     systemManager = new SystemManager();
     spriteSystem  = new SpriteSystem();
     line2DSystem  = new Line2DSystem();
     text2DSystem  = new Text2DSystem();
 }
Beispiel #5
0
 public UITestState(string name) : base(name)
 {
     entityManager = new EntityManager();
     systemManager = new SystemManager();
     text2DSystem  = new Text2DSystem();
     spriteSystem  = new SpriteSystem();
     buttonSystem  = new ButtonSystem();
 }
Beispiel #6
0
        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");
 }
Beispiel #8
0
        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();
        }
Beispiel #9
0
    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;
 }
Beispiel #11
0
 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();
 }
Beispiel #12
0
        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;
        }
Beispiel #13
0
        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;
        }
Beispiel #14
0
    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}
        });
    }
Beispiel #16
0
 public void Start()
 {
     _control          = GetComponent <PlayerControl>();
     _animation        = GetComponentInChildren <SpriteSystem>();
     _hitboxController = gameObject.GetComponentInChildren <HitboxController>();
 }
Beispiel #17
0
        // implementation of a Collider component

        public Sprite()
        {
            SpriteSystem.Register(this);
        }
Beispiel #18
0
    // 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 }
        });
    }
Beispiel #19
0
 public void Update(float gameTime)
 {
     TransformSystem.Update(gameTime);
     SpriteSystem.Update(gameTime);
     ColliderSystem.Update(gameTime);
 }
Beispiel #20
0
 public void Start()
 {
     _sense  = GetComponentInChildren <PlayerSense>();
     _sprite = GetComponentInChildren <SpriteSystem>();
 }
Beispiel #21
0
 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>();
 }