/// <summary> /// Creates slave item for the given spawnpoint. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="spawnPoint"></param> /// <returns></returns> private T CreateSlaveItem <T>(SpawnPoint spawnPoint) where T : PrefabSlaveItem, new() { var pos = GetAbsolutePosition(spawnPoint.Position); var item = PrefabSlaveItem.Add <T>(map, prefab, pos); item.Node.Rotation = spawnPoint.Rotation * prefabRot; item.Node.ForwardItem = item; return(item); }
/// <summary> /// Creates map nodes for all spawn points of the given type. /// </summary> /// <param name="item">The company item.</param> /// <param name="spawnPointType">The spawn point type.</param> /// <param name="node0Pos">The ppd position of the prefab's red control node.</param> /// <returns>A list of map nodes.</returns> private List <INode> CreateSpawnPointNodes(PrefabSlaveItem item, SpawnPointType spawnPointType) { var selected = clonedPoints.Where(x => x.Type == spawnPointType).ToList(); var list = new List <INode>(selected.Count); foreach (var spawnPoint in selected) { var spawnPos = GetAbsolutePosition(spawnPoint.Position); var spawnNode = map.AddNode(spawnPos, false); spawnNode.Rotation = Quaternion.Normalize( spawnPoint.Rotation * prefabRot); spawnNode.ForwardItem = item; list.Add(spawnNode); } for (int i = 0; i < selected.Count; i++) { clonedPoints.Remove(selected[i]); } return(list); }
public static Garage Add(IItemContainer map, Prefab parent, Vector3 position) { return(PrefabSlaveItem.Add <Garage>(map, parent, position)); }
public static Company Add(IItemContainer map, Prefab parent, Vector3 position) { return(PrefabSlaveItem.Add <Company>(map, parent, position)); }
public new static FuelPump Add(IItemContainer map, Prefab parent, Vector3 position) { return(PrefabSlaveItem.Add <FuelPump>(map, parent, position)); }
public static BusStop Add(IItemContainer map, Prefab parent, Vector3 position) { return(PrefabSlaveItem.Add <BusStop>(map, parent, position)); }