示例#1
0
        /// <inheritdoc/>
        public override WorldObject Clone()
        {
            WorldSound ws = (WorldSound)base.Clone();

            ws.Source   = null;
            ws.Follower = Follower?.Clone();
            ws.TrackFollowerFunction = TrackFollowerFunction?.Clone();
            ws.VolumeFunction        = VolumeFunction?.Clone();
            ws.PitchFunction         = PitchFunction?.Clone();
            return(ws);
        }
示例#2
0
        /// <summary>Creates the animated object within the game world</summary>
        /// <param name="position">The absolute position</param>
        /// <param name="BaseTransformation">The base transformation (Rail 0)</param>
        /// <param name="AuxTransformation">The auxilary transformation (Placed rail)</param>
        /// <param name="SectionIndex">The index of the section if placed using a SigF command</param>
        /// <param name="trackPosition">The absolute track position</param>
        public void CreateSound(Vector3 position, Transformation BaseTransformation, Transformation AuxTransformation, int SectionIndex, double trackPosition)
        {
            int        a   = currentHost.AnimatedWorldObjectsUsed;
            WorldSound snd = (WorldSound)Clone();

            snd.Position             = position;
            snd.TrackPosition        = trackPosition;
            snd.currentTrackPosition = trackPosition;
            snd.Follower             = new TrackFollower(currentHost);
            snd.Follower.UpdateAbsolute(trackPosition, true, true);

            currentHost.AnimatedWorldObjects[a] = snd;
            currentHost.AnimatedWorldObjectsUsed++;
        }
示例#3
0
        /// <summary>Creates the animated object within the game world</summary>
        /// <param name="position">The absolute position</param>
        /// <param name="BaseTransformation">The base transformation (Rail 0)</param>
        /// <param name="AuxTransformation">The auxilary transformation (Placed rail)</param>
        /// <param name="SectionIndex">The index of the section if placed using a SigF command</param>
        /// <param name="trackPosition">The absolute track position</param>
        public void CreateSound(Vector3 position, Transformation BaseTransformation, Transformation AuxTransformation, int SectionIndex, double trackPosition)
        {
            int a = currentHost.AnimatedWorldObjectsUsed;

            WorldSound snd = new WorldSound(currentHost, this.Buffer)
            {
                //Must clone the vector, not pass the reference
                Position              = new Vector3(position),
                Follower              = new TrackFollower(currentHost),
                currentTrackPosition  = trackPosition,
                TrackFollowerFunction = TrackFollowerFunction,
                PitchFunction         = PitchFunction,
                VolumeFunction        = VolumeFunction
            };

            snd.Follower.UpdateAbsolute(trackPosition, true, true);
            if (this.TrackFollowerFunction != null)
            {
                snd.TrackFollowerFunction = this.TrackFollowerFunction.Clone();
            }

            currentHost.AnimatedWorldObjects[a] = snd;
            currentHost.AnimatedWorldObjectsUsed++;
        }