public ShipSystemModel(string name, Forest <TreeNode <SystemComponent> > system, Dictionary <string, int[]> keys, HullModel hull) { this.name = name; this.system = system; this.keys = keys; this.hull = hull; }
public Hull(HullParameters parameters) : base(0, 0, ItemClass.Hull, ItemType.Hull) { Model = parameters.Model; Size = parameters.Size; Mass = parameters.MassMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); HullSpace = parameters.HullSpaceMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); MaximumHitPoints = parameters.HitPoints; CurrentHitPoints = MaximumHitPoints; TargetingType = parameters.TargetingType; }
void SetShip(HullModel model, Forest <SystemLink> links) { ship.transform.SetParent(transform); ship.SetHull(model, links, new FakeDriver()); float farPoint = ship.GetComponentsInChildren <MeshFilter>().Max(m => Vector3.Scale(m.transform.lossyScale, m.mesh.bounds.max).magnitude); ship.transform.localPosition = Vector3.forward * farPoint; zoomScale = farPoint / 2; SetRotatedTransform(); }
public void SetEmptyShip(string hullName) { CreateHull(hullName); Forest <SystemLink> system = new Forest <SystemLink>(); for (int i = 1; i <= ship.tacklesCount; i++) { system.AddTree(new SystemLink(new FakeComponent())); } HullModel hull = new HullModel(hullName, system.ByElements().Select((f, i) => new Tuple <int, int[]>(i, system.GetPath(f))).ToDictionary(t => t.Item1, t => t.Item2)); SetShip(hull, system); }
public void SetHull(HullModel model, Forest <SystemLink> link, ShipDriver driver) { var t = model.GetTackles(link); foreach (var e in t) { SetTackle(e.Key, e.Value) .SetDriver(driver); } foreach (var l in link.ByElements()) { l.enabled = true; } }
public Hull ( HullModel model, float size, float massMultiplier, float hullSpaceMultiplier, float hitPoints, TargetingType targetingType ) : base(0, 0, ItemClass.Hull, ItemType.Hull) { Model = model; Size = size; Mass = massMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); HullSpace = hullSpaceMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); MaximumHitPoints = hitPoints; CurrentHitPoints = MaximumHitPoints; TargetingType = targetingType; }