public static PathAIComponent Create(EncounterPath path) { var component = new PathAIComponent(); component.Path = path; return(component); }
public static ProjectileAIComponent Create(EncounterPath path, string targetId) { var component = new ProjectileAIComponent(); component.Path = path; component.TargetId = targetId; return(component); }
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); }
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); }