UnrealI
Class Magma

source: e:\games\UnrealTournament\UnrealI\Classes\Magma.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--UnrealI.BigRock
            |
            +--UnrealI.Magma
Direct Known Subclasses:None

class Magma
extends UnrealI.BigRock

//============================================================================= // Magma. //=============================================================================
Variables
 float BurnTime
 float DelaySmoke
 float InitialBrightness
 float LastSmokeTime
 float PassedTime

States
Flying

Function Summary
 void Timer()


State Flying Function Summary



Source Code


00001	//=============================================================================
00002	// Magma.
00003	//=============================================================================
00004	class Magma extends BigRock;
00005	
00006	// Owner (spawner) specifies the velocity of the Magma (implicitly in
00007	// Actor properties), the length of time it can burn for, the initial 
00008	// brightness, as well as the damage caused.  Modified from Sparkbit
00009	// and Rock.  MZM
00010	
00011	var() float DelaySmoke;
00012	var   float BurnTime;
00013	var   float InitialBrightness;
00014	var   float LastSmokeTime;
00015	var   float PassedTime;
00016	
00017	function Timer()
00018	 {
00019	
00020		// The Magma should lose its brightness as it
00021		// burns away, but not linearly - the main brightness
00022		// decays in quadratic fashion but the actual brightness
00023		// is also randomly tweaked to give the appearance of
00024		// non-uniform burning.  The object also gives off
00025		// its own light.
00026		//
00027		local float tempBrightness;
00028	
00029		PassedTime += 0.15;
00030		// Spawn smoke if enough time has passed.
00031		if (PassedTime-LastSmokeTime >= DelaySmoke) 
00032		{
00033			//Spawn (class 'SmokeTrail', , '', Location+Vect(0,0,8));
00034			LastSmokeTime = PassedTime;
00035		}
00036		tempBrightness = InitialBrightness*(1-
00037					    ((PassedTime*(1-0.1+0.2*FRand()))/BurnTime) **2);
00038		tempBrightness = FClamp (tempBrightness, 0, 1);
00039			
00040		LightBrightness = tempBrightness * 90;
00041		AmbientGlow     = tempBrightness * 240;
00042	}
00043	
00044	auto state Flying
00045	{
00046		simulated function HitWall (vector HitNormal, actor Wall)
00047		{
00048			InitialBrightness *= 1.5;
00049			Super.HitWall(HitNormal, Wall);
00050		}
00051	
00052	Begin:
00053		SetTimer(0.15, true);
00054		if (Speed != 0) Velocity = Vector(Rotation) * Speed;
00055		RotationRate = RotRand();
00056		BurnTime = FMin(BurnTime, 0.1);
00057		SetPhysics (PHYS_Falling);
00058	}
00059	
00060	defaultproperties
00061	{
00062	     LifeSpan=15.000000
00063	     bBlockActors=True
00064	     bBlockPlayers=True
00065	     LightType=LT_Steady
00066	     LightBrightness=130
00067	     LightHue=120
00068	     LightSaturation=200
00069	     LightRadius=30
00070	}

End Source Code