예제 #1
0
        public static PathAIComponent Create(EncounterPath path)
        {
            var component = new PathAIComponent();

            component.Path = path;

            return(component);
        }
예제 #2
0
        public static ProjectileAIComponent Create(EncounterPath path, string targetId)
        {
            var component = new ProjectileAIComponent();

            component.Path     = path;
            component.TargetId = targetId;

            return(component);
        }
예제 #3
0
        public void SerializesAndDeserializesCorrectly()
        {
            var path = new EncounterPath(new List <EncounterPosition>()
            {
                new EncounterPosition(15, 53)
            });

            var component = PlayerComponent.Create();

            component.LayInAutopilotPathForTravel(path);
            component.RegisterIntel(3);
            string saved = component.Save();

            var newComponent = PlayerComponent.Create(saved);

            Assert.Equal(component.KnowsIntel(0), newComponent.KnowsIntel(0));
            Assert.Equal(component.KnowsIntel(1), newComponent.KnowsIntel(1));
            Assert.Equal(component.KnowsIntel(2), newComponent.KnowsIntel(2));
            Assert.Equal(component.KnowsIntel(3), newComponent.KnowsIntel(3));
            Assert.Equal(component.CuttingLaserRange, newComponent.CuttingLaserRange);
            Assert.Equal(component.BaseCuttingLaserPower, newComponent.BaseCuttingLaserPower);
            Assert.Equal(component.ActiveAutopilotMode, newComponent.ActiveAutopilotMode);
            Assert.Equal(component.AutopilotPath.CurrentPosition, newComponent.AutopilotPath.CurrentPosition);
        }
예제 #4
0
        public static Entity CreateProjectileEntity(Entity source, ProjectileType type, int power, EncounterPath path, int speed, int currentTick)
        {
            var displayData = projectileTypeToProjectileDisplay[type];

            var e = CreateEntity(Guid.NewGuid().ToString(), displayData.Name);

            e.AddComponent(PathAIComponent.Create(path));

            e.AddComponent(ActionTimeComponent.Create(currentTick)); // Should it go instantly or should it wait for its turn...?
            e.AddComponent(AttackerComponent.Create(source.EntityId, power));
            e.AddComponent(CollisionComponent.Create(false, false, true, true));
            e.AddComponent(DisplayComponent.Create(displayData.TexturePath, "A projectile.", false, PROJECTILE_Z_INDEX));
            e.AddComponent(SpeedComponent.Create(speed));

            return(e);
        }