Exemplo n.º 1
0
 public TrainTransport(Vector3 position, AnimationManager.AnimatedObject animatedObject, ICSType trainType)
 {
     _meshedVehicleDescription = new MeshedVehicleDescription(new ClientMeshedObject(animatedObject.ObjType), trainType.TrainConfiguration.playerSeatOffset, trainType.TrainConfiguration.AllowPlayerToEditBlocksWhileRiding);
     _animatedObject           = animatedObject;
     Position              = position;
     TrainType             = trainType;
     _trainId              = ItemId.GetItemId(trainType.name);
     _idealHeightFromTrack = TrainType.TrainConfiguration.IdealHeightFromTrack;
     Delay            = TrainType.TrainConfiguration.MoveTimePerBlockMs;
     ManaCostPerBlock = TrainType.TrainConfiguration.EnergyCostPerBlock;
 }
Exemplo n.º 2
0
        public TrainTransport(TransportSave transportSave)
        {
            if (transportSave.type == _trackCalculationType.name)
            {
                Position                  = transportSave.position;
                _prevPosition             = transportSave.prevPos;
                _trainId                  = transportSave.itemName;
                TrackPosition             = transportSave.trackPos;
                TrainType                 = Train.TrainTypes[transportSave.itemName];
                _animatedObject           = Train.TrainAnimations[transportSave.itemName];
                _meshedVehicleDescription = new MeshedVehicleDescription(new ClientMeshedObject(_animatedObject.ObjType, new MeshedObjectID(transportSave.meshid)), TrainType.TrainConfiguration.playerSeatOffset, TrainType.TrainConfiguration.AllowPlayerToEditBlocksWhileRiding);
                _idealHeightFromTrack     = TrainType.TrainConfiguration.IdealHeightFromTrack;
                _energy          = transportSave.energy;
                Delay            = TrainType.TrainConfiguration.MoveTimePerBlockMs;
                ManaCostPerBlock = TrainType.TrainConfiguration.EnergyCostPerBlock;

                if (!string.IsNullOrEmpty(transportSave.player))
                {
                    _player = Players.GetPlayer(NetworkID.Parse(transportSave.player));
                    MeshedObjectManager.Attach(_player, _meshedVehicleDescription);
                }
            }
        }