UnrealI
Class Seeds

source: e:\games\UnrealTournament\UnrealI\Classes\Seeds.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--UnrealI.Seeds
Direct Known Subclasses:None

class Seeds
extends Engine.Pickup

//============================================================================= // Seeds. //=============================================================================
Variables
 float ShrinkTime
 vector X,Y,Z
 Seeds f

States
Shrinking, Activated
State Shrinking Function Summary
 void Tick(Float DeltaTime)
 void Timer()


State Activated Function Summary
 void Timer()
     
// Delete from inventory and toss in front of player.



Source Code


00001	//=============================================================================
00002	// Seeds.
00003	//=============================================================================
00004	class Seeds extends Pickup;
00005	
00006	#exec TEXTURE IMPORT NAME=I_Seed FILE=TEXTURES\HUD\i_seed.PCX GROUP="Icons" MIPS=OFF
00007	
00008	//#exec AUDIO IMPORT FILE="Sounds\Pickups\naliseed.WAV" NAME="naliseed" GROUP="Pickups"
00009	
00010	#exec MESH IMPORT MESH=Seed ANIVFILE=MODELS\Seed_a.3D DATAFILE=MODELS\Seed_d.3D X=0 Y=0 Z=0
00011	#exec MESH ORIGIN MESH=Seed X=0 Y=0 Z=0 
00012	#exec MESH SEQUENCE MESH=Seed SEQ=All STARTFRAME=0  NUMFRAMES=2
00013	#exec TEXTURE IMPORT NAME=Jseed1 FILE=MODELS\seed.PCX GROUP="Skins"
00014	#exec MESHMAP SCALE MESHMAP=Seed X=0.04 Y=0.04 Z=0.08
00015	#exec MESHMAP SETTEXTURE MESHMAP=Seed NUM=1 TEXTURE=Jseed1
00016	 
00017	var vector X,Y,Z;
00018	var Seeds f;
00019	var float ShrinkTime;
00020	
00021	state Activated  // Delete from inventory and toss in front of player.
00022	{
00023		function Timer()
00024		{
00025			GoToState('Shrinking');
00026		}
00027	
00028		simulated function HitWall( vector HitNormal, actor Wall )
00029		{
00030			Velocity = 0.6*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity);   // Reflect off Wall w/damping
00031			bRotatetoDesired=True;
00032			bFixedRotationDir=False;
00033			DesiredRotation.Pitch=0;	
00034			DesiredRotation.Yaw=FRand()*65536;
00035			DesiredRotation.Roll=0;		
00036			RotationRate.Yaw = RotationRate.Yaw*0.75;
00037			RotationRate.Roll = RotationRate.Roll*0.75;
00038			RotationRate.Pitch = RotationRate.Pitch*0.75;	
00039			If (VSize(Velocity) < 5)
00040			{
00041				bBounce = False;
00042				SetPhysics(PHYS_None);
00043				SetTimer(0.5,False);
00044			}
00045		}
00046	Begin:
00047		if (NumCopies>0)
00048		{
00049			NumCopies--;
00050			GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
00051			f=Spawn(class, Owner, '', Pawn(Owner).Location +10*Y - 20*Z );
00052			f.NumCopies=-10;
00053			f.GoToState('Activated');
00054			GoToState('');
00055		}
00056		else
00057		{
00058			Disable('Touch');
00059			GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);
00060			SetPhysics(PHYS_Falling);
00061			Velocity = Owner.Velocity + Vector(Pawn(Owner).ViewRotation) * 250.0;
00062			Velocity.z += 100;
00063			DesiredRotation = RotRand();
00064			RotationRate.Yaw = 200000*FRand() - 100000;
00065			RotationRate.Pitch = 200000*FRand() - 100000;
00066			RotationRate.Roll = 200000*FRand() - 100000;
00067			bFixedRotationDir=True;
00068			SetLocation(Owner.Location+Y*10-Z*20);
00069			if (NumCopies>-5) {
00070				Pawn(Owner).NextItem();
00071				if (Pawn(Owner).SelectedItem == Self) Pawn(Owner).SelectedItem=None;	
00072				Pawn(Owner).DeleteInventory(Self);
00073			}
00074			BecomePickup();		
00075			bBounce=True;
00076			bCollideWorld=True;		
00077		}
00078	}
00079	
00080	
00081	state Shrinking
00082	{
00083	
00084		function Timer()
00085		{
00086			Spawn(class'NaliFruit',,,Location+Vect(0,0,20),Rotator(Vect(0,1,0)));
00087			Destroy();
00088		}
00089		
00090		function Tick(Float DeltaTime)
00091		{
00092			ShrinkTime += DeltaTime;
00093			DrawScale = 1.0 - fMin(ShrinkTime,0.95);
00094		}
00095	
00096	Begin:
00097		ShrinkTime = 0;
00098		SetTimer(0.7,False);
00099	}
00100	
00101	defaultproperties
00102	{
00103	     bCanHaveMultipleCopies=True
00104	     bActivatable=True
00105	     bDisplayableInv=True
00106	     PickupMessage="You got the Nali fruit seeds"
00107	     RespawnTime=30.000000
00108	     PickupViewMesh=LodMesh'UnrealI.Seed'
00109	     PickupSound=Sound'UnrealShare.Pickups.GenPickSnd'
00110	     Icon=Texture'UnrealI.Icons.I_Seed'
00111	     Mesh=LodMesh'UnrealI.Seed'
00112	     CollisionRadius=12.000000
00113	     CollisionHeight=4.000000
00114	     bCollideWorld=True
00115	     bProjTarget=True
00116	}

End Source Code