示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
文件: Garage.cs 项目: sk-zk/TruckLib
 public static Garage Add(IItemContainer map, Prefab parent, Vector3 position)
 {
     return(PrefabSlaveItem.Add <Garage>(map, parent, position));
 }
示例#4
0
 public static Company Add(IItemContainer map, Prefab parent, Vector3 position)
 {
     return(PrefabSlaveItem.Add <Company>(map, parent, position));
 }
示例#5
0
 public new static FuelPump Add(IItemContainer map, Prefab parent, Vector3 position)
 {
     return(PrefabSlaveItem.Add <FuelPump>(map, parent, position));
 }
示例#6
0
 public static BusStop Add(IItemContainer map, Prefab parent, Vector3 position)
 {
     return(PrefabSlaveItem.Add <BusStop>(map, parent, position));
 }