public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); _terrainLayer = BlackBoard.GetEntry <TerrainLayer>("TerrainLayer"); _counters[0] = _grid.Size; }
public override void Process(Entity entity) { var player = entity.GetComponent <PlayerComponent>(); var input = BlackBoard.GetEntry <Input>("Input"); // if (!input.PlayerInput.ContainsKey(player.Id)) // return; ConcurrentQueue <JToken> commands = null; if (input.PlayerInput.TryGetValue(player.Id, out commands)) { //var commands = input.PlayerInput[player.Id]; JToken command; while (commands.TryDequeue(out command)) { var type = command["type"].Value <string>(); switch (type) { case "move": ProcessMove(entity, command); break; case "move_stop": ProcessMoveStop(entity, command); break; default: // send type error break; } //Process } } }
public override void LoadContent() { _content = BlackBoard.GetEntry <ContentManager>("ContentManager"); _graphicsDevice = BlackBoard.GetEntry <GraphicsDevice>("GraphicsDevice"); _camera = BlackBoard.GetEntry <CameraComponent>("Camera"); _map = BlackBoard.GetEntry <Map>("Map"); _texture = _content.Load <Texture2D>("Images/OryxEnv"); _effect = new BasicEffect(_graphicsDevice); _effect.TextureEnabled = true; _effect.Texture = _texture; _quads = new List <QuadShape>(); for (int z = 0; z < _map.Height; z++) { for (int x = 0; x < _map.Width; x++) { Vector3 quadOrigin = new Vector3(x, 0, z); TextureFrame textureFrame = new TextureFrame(0.375f, 0, 0.0625f, 0.0625f); QuadShape quad = new QuadShape(quadOrigin, Vector3.Up, Vector3.Forward, textureFrame); _quads.Add(quad); } } }
public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); byte[,] calculateGrid = CalculateGrid(_grid); _pathFinder = new PathFinder(calculateGrid); }
public override void Process(Entity entity) { Entity player = (Entity)BlackBoard.GetEntry("Player"); CollisionBox playerBox = player.GetComponent <CollisionBox>(); Position playerPosition = player.GetComponent <Position>(); Rectangle playerRectangle = new Rectangle( (int)playerPosition.X + playerBox.OffsetX, (int)playerPosition.Y + playerBox.OffsetY, playerBox.Width, playerBox.Height); CollisionBox enemyBox = entity.GetComponent <CollisionBox>(); Position enemyPosition = entity.GetComponent <Position>(); Rectangle enemyRectangle = new Rectangle( (int)enemyPosition.X + enemyBox.OffsetX, (int)enemyPosition.Y + enemyBox.OffsetY, enemyBox.Width, enemyBox.Height); Script script = entity.GetComponent <Script>(); var type = playerRectangle.GetCollisionType(enemyRectangle); if (type == CollisionType.None || string.IsNullOrWhiteSpace(script.FilePath)) { return; } _scriptManager.QueueScript(script.FilePath, entity, "OnTouch"); }
public override void LoadContent() { _netAgent = BlackBoard.GetEntry <NetworkAgent>("NetworkAgent"); _updatesPerSecond = 10.0f; _nextSendUpdates = NetTime.Now; _sendUpdates = false; }
public void ResetDotEntityPosition(Entity entity) { Random random = BlackBoard.GetEntry <Random>("Random"); int x = random.Next(graphicsDevice.Viewport.Width / 16); int y = random.Next(graphicsDevice.Viewport.Height / 16); entity.GetComponent <DotComponent>().Init(x * 16, y * 16); }
/// <summary>Override to implement code that gets executed when systems are initialized.</summary> public override void LoadContent() { this.spriteBatch = BlackBoard.GetEntry <SpriteBatch>("SpriteBatch"); ContentManager contentManager = BlackBoard.GetEntry <ContentManager>("ContentManager"); texture2D = contentManager.Load <Texture2D>("Images/whitepixel"); this.graphicsDevice = BlackBoard.GetEntry <GraphicsDevice>("GraphicsDevice"); }
public override void LoadContent() { _content = BlackBoard.GetEntry <ContentManager>("ContentManager"); _graphicsDevice = BlackBoard.GetEntry <GraphicsDevice>("GraphicsDevice"); _camera = BlackBoard.GetEntry <CameraComponent>("Camera"); _effect = new BasicEffect(_graphicsDevice); _effect.TextureEnabled = true; }
public override void LoadContent() { base.LoadContent(); _eventBus = BlackBoard.GetEntry <JEventBus>("EventBus") ?? JEventBus.GetDefault(); _eventBus.Register(this); var _grid = BlackBoard.GetEntry <Grid>("Grid"); _dijkstraPathFinder = new DijkstraPathFinder(ByteArrayHelper.CreateBase(_grid.Width)); }
public override void Process(Entity entity) { var transform = entity.GetComponent <Transform>(); var renderer = entity.GetComponent <Texture2DRenderer>(); var spriteBatch = BlackBoard.GetEntry <SpriteBatch>("SpriteBatch"); var texture = BlackBoard.GetEntry <ContentManager>("ContentManager").Load <Texture2D>(renderer.TextureName); spriteBatch.Draw(texture, transform.renderPosition, null, null, transform.globalOrigin, transform.renderRotation, transform.renderScale); }
public override void LoadContent() { graphicsDevice = BlackBoard.GetEntry <GraphicsDevice>("GraphicsDevice"); contentManager = BlackBoard.GetEntry <ContentManager>("ContentManager"); if (this.entityWorld.TagManager.GetEntity("SNEKDOT") == null) { CreateDotEntity(); } base.LoadContent(); }
public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); _actionDefinition = new ActionDefinition("RecruitmentAction"); _actionAnswers = new List <ActionAnswer> { new ActionAnswer("TakeMax"), new ActionAnswer("Cancel") }; }
public override void LoadContent() { base.LoadContent(); _grid = BlackBoard.GetEntry <Grid>("Grid"); _actionDefinition = new ActionDefinition("ChestAction"); _actionAnswers = new List <ActionAnswer> { new ActionAnswer("TakeGold"), new ActionAnswer("TakeExperience") }; }
public override void Process() { Entity player = (Entity)BlackBoard.GetEntry("Player"); if (player == null) { return; } Position position = player.GetComponent <Position>(); _cameraManager.Focus(position.X, position.Y + 30); }
public override void ProcessSystem() { float delta = BlackBoard.GetEntry <float>("delta"); float y = 0f; while (y < window.Height / LD34Game.Scale) { float x = offset0; while (x < window.Width / LD34Game.Scale) { spriteBatch.Draw(stars0, new Vector2(x, y), Color.White); x += stars0.Width; } x = offset1; while (x < window.Width / LD34Game.Scale) { spriteBatch.Draw(stars1, new Vector2(x, y), Color.White); x += stars1.Width; } x = offset2; while (x < window.Width / LD34Game.Scale) { spriteBatch.Draw(stars2, new Vector2(x, y), Color.White); x += stars2.Width; } y += stars0.Height; } offset0 -= delta; if (offset0 <= -stars0.Width) { offset0 += stars0.Width; } offset1 -= delta * 2f; if (offset1 <= -stars1.Width) { offset1 += stars1.Width; } offset2 -= delta * 4f; if (offset2 <= -stars2.Width) { offset2 += stars2.Width; } }
public PlanSet GetPlan(Goal goal, List <PloobsEngine.IA.Action> Actions) { AstarPlanner Planner = new AstarPlanner(); Planner.MaxIteration = int.MaxValue; Planner.Actions = Actions; WorldState WorldState = BlackBoard.GetEntry <WorldState>("WorldState"); PlanSet PlanSet = Planner.CreatePlan( WorldState, goal ); return(PlanSet); }
private void PlayerConnect(PlayerConnectMessage <UmbraEntityType> msg) { long entityId = msg.EntityId; Entity player = CrawEntityManager.Instance.EntityFactory.CreatePlayer((long?)entityId, msg.Position); if (msg.IsSelf) { player.Tag = "PLAYER"; // TODO: this probably shouldn't happen here CameraComponent camera = BlackBoard.GetEntry <CameraComponent>("Camera"); camera.Target = player.GetComponent <TransformComponent>(); } }
/// <summary>Initializes a new instance of the <see cref="TestCommunicationSystem" /> class.</summary> public TestCommunicationSystem() : base(Aspect.All(typeof(TestHealthComponent))) { this.damage = 10; BlackBoard.AddTrigger( new SimpleTrigger( "Damage", (a, b) => true, a => { if (a == TriggerStateType.ValueChanged) { this.damage = BlackBoard.GetEntry <int>("Damage"); } })); this.damage = BlackBoard.GetEntry <int>("Damage"); }
public DummyCommunicationSystem() : base(typeof(Health)) { blackBoard.AddTrigger( new SimpleTrigger("Damage", (a, b) => { return(true); } , (a) => { if (a == TriggerState.VALUE_CHANGED) { damage = BlackBoard.GetEntry <int>("Damage"); } } )); damage = BlackBoard.GetEntry <int>("Damage"); }
public override void ProcessSystem() { float delta = BlackBoard.GetEntry <float>("delta"); int total = EntityWorld.SystemManager.GetSystem <PlayerHandSystem>()[0].TotalResources; int spent = EntityWorld.SystemManager.GetSystem <PlayerHandSystem>()[0].SpentResources; for (int i = 0; i < total; i++) { spriteBatch.Draw(i < total - spent ? resourceAvailable : resourceSpent, new Vector2((window.Width / LD34Game.Scale) / 2f - total * resourceAvailable.Width / 2 + i * resourceAvailable.Width, window.Height / LD34Game.Scale - resourceAvailable.Height), Color.White); } total = EntityWorld.SystemManager.GetSystem <EnemyHandSystem>()[0].TotalResources; spent = EntityWorld.SystemManager.GetSystem <EnemyHandSystem>()[0].SpentResources; for (int i = 0; i < total; i++) { spriteBatch.Draw(i < total - spent ? resourceAvailableFlipped : resourceSpentFlipped, new Vector2((window.Width / LD34Game.Scale) / 2f - total * resourceAvailable.Width / 2 + i * resourceAvailable.Width, 0f), Color.White); } }
public override void Process(Entity entity) { Position textPosition = entity.GetComponent <Position>(); textPosition.X = _camera.TopLeft.X; textPosition.Y = _camera.TopLeft.Y; Entity player = BlackBoard.GetEntry <Entity>("Player"); Velocity velocity = player.GetComponent <Velocity>(); Position position = player.GetComponent <Position>(); PlayerStateMap stateMap = player.GetComponent <PlayerStateMap>(); PlayerCharacter character = player.GetComponent <PlayerCharacter>(); string text = $"VelocityX: {velocity.X}\n" + $"VelocityY: {velocity.Y}\n" + $"PosX: {position.X}\n" + $"PosY: {position.Y}\n" + $"CurrentState: {stateMap.CurrentState}\n" + $"IsWallSliding: {character.IsWallSliding}\n"; VisibleText textComponent = entity.GetComponent <VisibleText>(); textComponent.Message = text; }
public override void LoadContent() { _netAgent = BlackBoard.GetEntry <NetworkAgent>("NetworkAgent"); _camera = BlackBoard.GetEntry <CameraComponent>("Camera"); }
/// <summary>Override to implement code that gets executed when systems are initialized.</summary> public override void LoadContent() { _game = BlackBoard.GetEntry <Game>("Game"); }
public override void LoadContent() { _networkAgent = BlackBoard.GetEntry <NetworkAgent>("NetworkAgent"); }
/// <summary>Override to implement code that gets executed when systems are initialized.</summary> public override void LoadContent() { this.spriteBatch = BlackBoard.GetEntry <SpriteBatch>("SpriteBatch"); this.font = BlackBoard.GetEntry <SpriteFont>("SpriteFont"); }
/// <summary>Override to implement code that gets executed when systems are initialized.</summary> public override void LoadContent() { _game = BlackBoard.GetEntry <Game>("Game"); _renderer = BlackBoard.GetEntry <Renderer>(nameof(Renderer)); }
public override void LoadContent() { base.LoadContent(); _eventBus = BlackBoard.GetEntry <JEventBus>("EventBus") ?? JEventBus.GetDefault(); _eventBus.Register(this); }
public override void LoadContent() { this.contentManager = BlackBoard.GetEntry <ContentManager>("ContentManager"); this.spriteBatch = BlackBoard.GetEntry <SpriteBatch>("SpriteBatch"); }
protected override void Begin() { delta = BlackBoard.GetEntry <float>("delta"); }