# SFDecos.SFInterpolatingObject

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 |
    //=============================================================================
    // Spatial Fear
    // Class: SFInterpolatingObject
    // Description: An object that will move along a path. To choose path, make path's first point's
    //              "Event" variable the same as this object's "Event" variable.
    //
    //              If you want a player to be able to stop an object, set bStoppable to TRUE - when
    //              player triggers a trigger that started a movement, object will stop. If triggered
    //              again, an object will start its movement from beginnig. If you want to prevent this
    //              set bCanMoveAgain to FALSE - once stopped, object won't move again.
    //
    //              As default, objects that move along a path has switeched off collision detecion.
    //              When object is stopped collisions are turned on again. If you want an object to
    //              preserve collision detecion while it moves, set bCanCollide to TRUE. I've noticed that when object
    //              stucks in the wall, after a few seconds it will start movement again.
    //
    // Author: Jacek Zagrodzki (moose)
    //=============================================================================
    class SFInterpolatingObject expands SFDecoration;

    // public variables:
    var() bool	bStoppable;		// if TRUE, object can be stopped while in movement
    var() bool	bCanMoveAgain;		// FALSE - once stopped, object won't be able to move again. If TRUE, object can be triggered to move again, it will move from the beginnig of its path.
    var() bool	bCanCollide;		// if FALSE, object won't colide while in movement

    // private variables:
    var bool		bMoving;		// TRUE if object is in move
    var bool		bMovedOnce;	// TRUE if object has moved at least once

    function Destroyed()
    {
    	event=''; // no event on destruction;
    	Super.Destroyed();
    }

    function interpolateend(actor Other)
    {
    }

    function Trigger( actor Other, pawn EventInstigator )
    {
    	local InterpolationPoint i;

    	if(!bMoving)
    	{
    		if(!bCanMoveAgain && bMovedOnce)
    			return;	// object has been stopped and it can't move again

    		foreach AllActors(class 'InterpolationPoint', i)
    		{
    			if( (i.Position == 0) && (i.Event == Event) )
    			{
    				bMoving = True;

    				if(!bCanCollide)
    					SetCollision(false,false,false);
    				Target = i;
    				SetPhysics(PHYS_Interpolating);
    				PhysRate = 1.0;
    				PhysAlpha = 0.0;
    				bInterpolating = true;
    			}
    		}
    	}
    	else
    	{
    		if(bStoppable)
    			StopMovement();
    	}
    }

    function StopMovement()
    {
    	bMoving = False;
    	bMovedOnce = True;

    	bInterpolating = false;
    	if(!bCanCollide)
    		SetCollision(default.bCollideActors, default.bBlockActors, default.bBlockPlayers);
    	bCollideWorld=True;
    	Target = None;
    	SetPhysics(default.Physics);
    }

    defaultproperties
    {
         bStoppable=True
         bCanMoveAgain=True
         bStatic=False
         DrawType=DT_Mesh
         Mesh=LodMesh'UnrealShare.CandleM'
    }

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX