Beispiel #1
0
        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);
        }
Beispiel #2
0
 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();
 }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
 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), };
     }
 }
Beispiel #6
0
 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();
 }
Beispiel #8
0
 public void BuildFromDomain(LevelTree levelTree, IList<Group> groups)
 {
     foreach (Group group in groups)
         BuildGroupTree(levelTree, group);
 }
Beispiel #9
0
 public static GroupBranch CreateAndAttachTo(LevelTree level, Data groupData, RotationData rotationData)
 {
     return new GroupBranch(new Vector3(), groupData, rotationData, level);
 }