Core.Object | +--Engine.Actor | +--Engine.Decoration | +--RuneI.DecorationRune | +--RuneI.Gib
void
Timer()
HitWall(vector hitNormal, Actor hitWall)
Landed(vector HitNormal, Actor HitActor)
EndState()
BeginState()
00001 //============================================================================= 00002 // Gib. 00003 //============================================================================= 00004 class Gib expands DecorationRune; 00005 00006 auto state FallingGib 00007 { 00008 function BeginState() 00009 { 00010 SetPhysics(PHYS_Falling); 00011 //SetCollision(true, false, false); 00012 //bCollideWorld = true; 00013 bBounce = true; 00014 bFixedRotationDir = true; 00015 DesiredRotation.Yaw = Rotation.Yaw + Rand(2000) - 1000; 00016 RotationRate.Yaw = 50000; 00017 } 00018 00019 function EndState() 00020 { 00021 bBounce = false; 00022 //SetCollision(false, false, false); 00023 //bCollideWorld = false; 00024 bBounce = false; 00025 bFixedRotationDir = false; 00026 } 00027 00028 function Landed(vector HitNormal, actor HitActor) 00029 { 00030 HitWall(HitNormal, HitActor); 00031 } 00032 00033 function HitWall(vector hitNormal, actor hitWall) 00034 { 00035 local float speed; 00036 00037 speed = VSize(Velocity); 00038 // MakeHitSound(hitNormal, speed); 00039 00040 // Apply a velocity to any pawns that the rock hits 00041 if(hitWall.bIsPawn) 00042 { 00043 Pawn(hitWall).AddVelocity(Velocity * 0.5); 00044 } 00045 00046 if(speed < 10 || (hitNormal.Z > 0.8 && speed < 60)) 00047 { 00048 SetPhysics(PHYS_Falling); 00049 bBounce = false; 00050 bFixedRotationDir = false; 00051 SetTimer(2.0, false); 00052 } 00053 else 00054 { 00055 SetPhysics(PHYS_Falling); 00056 RotationRate.Yaw = VSize(Velocity)*100; 00057 00058 if(HitNormal.Z > 0.8) 00059 Velocity = 0.30 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal)); 00060 else 00061 Velocity = 0.55 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal)); 00062 00063 DesiredRotation = rotator(HitNormal); 00064 } 00065 } 00066 00067 function Timer() 00068 { 00069 GotoState(''); 00070 } 00071 00072 begin: 00073 } 00074 00075 defaultproperties 00076 { 00077 bStatic=False 00078 DrawType=DT_SkeletalMesh 00079 bCollideWorld=True 00080 }