Beispiel #1
0
        public GameObject GetFoodAt(Position position)
        {
            var bot = new GameObject
            {
                Id             = Guid.NewGuid(),
                Size           = 1,
                Position       = position,
                Speed          = 0,
                GameObjectType = GameObjectType.Food
            };

            worldStateService.AddGameObject(bot);
            return(bot);
        }
Beispiel #2
0
        protected GameObject PlaceFoodAtPosition(Position position)
        {
            var gameObject = new GameObject
            {
                Id             = Guid.NewGuid(),
                Position       = position,
                GameObjectType = GameObjectType.Food,
                Size           = EngineConfigFake.Value.WorldFood.FoodSize
            };

            WorldStateService.AddGameObject(gameObject);
            return(gameObject);
        }
        public void ProcessAction(BotObject bot)
        {
            var torpedoSalvo = new TorpedoGameObject()
            {
                Id       = Guid.NewGuid(),
                Position = vectorCalculatorService.GetPositionFrom(bot.Position, bot.Size + engineConfig.Torpedo.Size + 1, bot.CurrentAction
                                                                   .Heading),
                Size           = engineConfig.Torpedo.Size,
                Speed          = engineConfig.Torpedo.Speed,
                CurrentHeading = bot.CurrentAction.Heading,
                FiringPlayerId = bot.Id
            };

            bot.Size -= engineConfig.Torpedo.Cost;
            worldStateService.UpdateBotSpeed(bot);

            worldStateService.AddGameObject(torpedoSalvo);
        }