Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Environment.RainCyd


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
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
//=============================================================================
// RainCyd.
//=============================================================================
class RainCyd extends Effects;

#exec OBJ LOAD File=..\Textures\VertexT.utx
#exec OBJ LOAD File=..\StaticMeshes\VertexM.usx

// Set this to be the height of the cylinder when DrawScale == 1.0
// The rest of the calculations will be done automatically.
var() float CylinderHeight;

// Number of units this object may be place above the ground.
var() float TraceDepth;	

// How many should be stacked on top of each other.
var() int StackNum;

// Must set this to true if placed via the editor.
var() bool bMaster;
var bool bMasterInited;

// How many units to fall per second.
var() float MinFallRate;
var() float MaxFallRate;

// A directional vector that faces "down".
// Think of it as velocity.
//OLD var vector FallRate;

// How many degrees to rotate per second.
var() float MinRotRate;
var() float MaxRotRate;
var float RotRate;
var float RotAngle;
var rotator InitialRotation;
var bool bInitialized;
var vector InitialLocation;

// The point below us where we hit the ground.
var vector HitLocation;

// The distance beneath the ground this object must be
// before being moved back to the top of the stack.
var() float BuryDistance;

//------------------------------------------------------------------------------
simulated event Tick( float DeltaTime )
{
	local vector X, Y, Z, NotUsed;
	local rotator Rot;
	local int i;
	local RainCyd R;
	
	if( Role == ROLE_Authority && !bInitialized )
	{
		bInitialized = true;
		// Randomize roll.
		SetRotation( Rotation + rot(0,65536,0) * FRand() );
		InitialRotation = Rotation;
		InitialLocation = Location;
	}
	
	if( bMaster && !bMasterInited )
	{
		bMasterInited = true;

		GetAxes( Rotation, NotUsed, NotUsed, Z ); 
		Velocity = -Z * RandRange( MinFallRate, MaxFallRate );
		RotRate = RandRange( MinRotRate, MaxRotRate );
		CylinderHeight = default.CylinderHeight * DrawScale;
		Trace( HitLocation, NotUsed, InitialLocation + Normal(Velocity) * TraceDepth, InitialLocation, False );

		SetLocation( HitLocation - Normal(Velocity) * CylinderHeight + Normal(Velocity) * BuryDistance );
		
		for( i = 1; i < StackNum; i++ )
		{
			R = Spawn( Class,,, Location - Normal(Velocity) * (i * CylinderHeight) );
			
			// Copy all relavant variables.
			R.HitLocation		= HitLocation;
			R.InitialRotation	= InitialRotation;
			R.Velocity			= Velocity;
			R.RotRate			= RotRate;
			R.ScaleGlow			= ScaleGlow;
			R.SetDrawScale		( DrawScale );
			R.VisibilityRadius	= VisibilityRadius;
			R.VisibilityHeight	= VisibilityHeight;
			R.DetailLevel		= DetailLevel;
			R.CylinderHeight	= CylinderHeight;
			R.StackNum			= StackNum;
			R.BuryDistance		= BuryDistance;
			R.Skins[0]			= Skins[0];
			R.RemoteRole		= ROLE_None;
		}
	}

	// Update location.
	SetLocation( Location + Velocity * DeltaTime );

	// Update rotation.
	if( RotRate != 0 )
	{
		RotAngle += RotRate * DeltaTime;
		GetAxes( InitialRotation, X, Y, Z );
		SetRotation( InitialRotation + rotator(X * class'Util'.static.Cos( RotAngle * DegreesToRadians ) + Y * class'Util'.static.Sin( RotAngle*DegreesToRadians )) );
	}

	// If we go BuryDistance beyond our HitLocation, go back to the top of the stack.
	// NOTE: This assumes that FallRate will never change.  
	// This prevents us from having rain tha changes direction over time.  
	if( !class'Util'.static.VectorAproxEqual( Normal(Velocity), Normal(HitLocation + (Normal(Velocity) * BuryDistance) - Location) ) )
	{
		SetLocation( Location - Normal(Velocity) * (StackNum * CylinderHeight) );
	}
	
	Super.Tick( DeltaTime );
}

defaultproperties
{
	CylinderHeight=48.000000
	TraceDepth=1000.000000
	StackNum=5
	MinFallRate=500.000000
	MaxFallRate=700.000000
	BuryDistance=100.000000
	DrawType=DT_StaticMesh
	StaticMesh=StaticMesh'VertexM.Decorations.Xmesh'
	Texture=None
	Style=STY_Translucent
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:41.391 - Created with UnCodeX