public TrainController(LevelTree level, SplitTrack startTrack, GameObject trainPrefab, TrackConnectionResolver connectionResolver) { SubTrackGroup stGroup = startTrack.FirstSubTrack.FirstGroup; _trackRunner = new TrackRunner(connectionResolver, stGroup, false); GameObject go = Object.Instantiate(trainPrefab); _trackFollowingGO = new TrackFollowingGameObject(go, _trackRunner, Vector3.forward); }
internal SplitSide(LevelTree levelTree, Split split, bool lhs) { _split = split; Lhs = lhs; Group = levelTree.GetGroupBranch(split.Group); AttachedRotateables = split.AttachedGroups .Where(attached => attached.Lhs == lhs) .Select(attached => levelTree.GetGroupBranch(attached.AttachedGroup)) .ToArray(); }
private GroupBranch(Vector3 pos, Data groupData, RotationData rotationData, LevelTree level) : base(groupData.Group.Id, pos, rotationData, level) { Level = level; GroupData = groupData; ParticlesLeaf = new BaseTree("Particles", new Vector3(), this, NodeConfig.Dynamic); DoodadsLeaf = new BaseTree("Doodads", new Vector3(), this, NodeConfig.Dynamic); level.AddGroupBranch(this); foreach (SplitTrack track in Tracks) { track.OnAttachedToGroupBranch(this); } }
private void BuildGroupTree(LevelTree levelTree, Group group) { GroupBranch.Data groupData = new GroupBranch.Data(group); RotateableBranch.RotationData rotationData = new RotateableBranch.RotationData(BlockBounds.Unbounded, false); GroupBranch groupBranch = GroupBranch.CreateAndAttachTo(levelTree, groupData, rotationData); levelTree.ConnectionResolver.AddConnectionsFromGroup(group); //CreateSplitBranches(groupBranch, group); _trackBuilder.BuildSplitTracks(groupBranch, group.Tracks); _blockBuilder.BuildBlocks(groupBranch, group.SplittedMeshBlocks); levelTree.RegisterController( CreateJunctionControllers(groupBranch, group.Junctions)); }
public IEnumerable<SplitSide> GetActiveSides(LevelTree levelTree) { switch (Restriction) { case RestrictionType.Below: return new[] { new SplitSide(levelTree, this, true) }; case RestrictionType.Above: return new[] { new SplitSide(levelTree, this, false) }; default: return new[] { new SplitSide(levelTree, this, true), new SplitSide(levelTree, this, false), }; } }
public TreeRotater(LevelTree levelTree, EventRegistry eventRegistry) { _eventRegistry = eventRegistry; _levelTree = levelTree; }
public BlockRotaterController(LevelTree levelTree, EventRegistry eventRegistry) { _eventRegistry = eventRegistry; _treeRotater = new TreeRotater(levelTree, eventRegistry); _splitSides = levelTree.Level.AllSplits.SelectMany(split => split.GetActiveSides(levelTree)).ToArray(); }
public void BuildFromDomain(LevelTree levelTree, IList<Group> groups) { foreach (Group group in groups) BuildGroupTree(levelTree, group); }
public static GroupBranch CreateAndAttachTo(LevelTree level, Data groupData, RotationData rotationData) { return new GroupBranch(new Vector3(), groupData, rotationData, level); }