Core.Object | +--Engine.Actor | +--Engine.Effects | +--UnrealShare.Chip
bool
bHasBounced
00001 //============================================================================= 00002 // Chip. 00003 //============================================================================= 00004 class Chip extends Effects; 00005 00006 #exec MESH IMPORT MESH=ChipM ANIVFILE=MODELS\chip_a.3D DATAFILE=MODELS\chip_d.3D X=0 Y=0 Z=0 00007 #exec MESH ORIGIN MESH=ChipM X=0 Y=0 Z=0 YAW=0 00008 #exec MESH SEQUENCE MESH=ChipM SEQ=All STARTFRAME=0 NUMFRAMES=4 00009 #exec MESH SEQUENCE MESH=ChipM SEQ=Position1 STARTFRAME=0 NUMFRAMES=1 00010 #exec MESH SEQUENCE MESH=ChipM SEQ=Position2 STARTFRAME=1 NUMFRAMES=1 00011 #exec MESH SEQUENCE MESH=ChipM SEQ=Position3 STARTFRAME=2 NUMFRAMES=1 00012 #exec MESH SEQUENCE MESH=ChipM SEQ=Position4 STARTFRAME=3 NUMFRAMES=1 00013 #exec TEXTURE IMPORT NAME=Chip1 FILE=MODELS\chip.PCX GROUP=Skins 00014 #exec MESHMAP SCALE MESHMAP=ChipM X=0.03 Y=0.03 Z=0.06 00015 #exec MESHMAP SETTEXTURE MESHMAP=ChipM NUM=1 TEXTURE=Chip1 00016 00017 var bool bHasBounced; 00018 00019 auto state Flying 00020 { 00021 simulated function HitWall( vector HitNormal, actor Wall ) 00022 { 00023 local vector RealHitNormal; 00024 00025 if ( bHasBounced && ((FRand() < 0.85) || (Velocity.Z > -50)) ) 00026 bBounce = false; 00027 RealHitNormal = HitNormal; 00028 HitNormal = Normal(HitNormal + 0.4 * VRand()); 00029 if ( (HitNormal Dot RealHitNormal) < 0 ) 00030 HitNormal *= -0.5; 00031 Velocity = 0.5 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal)); 00032 RotationRate.Yaw = 100000 * 2 *FRand() - 100000; 00033 RotationRate.Pitch = 100000 * 2 *FRand() - 100000; 00034 RotationRate.Roll = 100000 * 2 *FRand() - 100000; 00035 DesiredRotation = RotRand(); 00036 bHasBounced = True; 00037 } 00038 00039 simulated function Landed( vector HitNormal ) 00040 { 00041 local rotator RandRot; 00042 00043 SetPhysics(PHYS_None); 00044 RandRot = Rotation; 00045 RandRot.Pitch = 0; 00046 RandRot.Roll = 0; 00047 SetRotation(RandRot); 00048 } 00049 00050 simulated function BeginState() 00051 { 00052 if (FRand()<0.25) PlayAnim('Position1'); 00053 else if (FRand()<0.25) PlayAnim('Position2'); 00054 else if (FRand()<0.25) PlayAnim('Position3'); 00055 else PlayAnim('Position4'); 00056 Velocity = VRand()*200*FRand()+Vector(Rotation)*250; 00057 DesiredRotation = RotRand(); 00058 RotationRate.Yaw = 200000 * 2 *FRand() - 200000; 00059 RotationRate.Pitch = 200000 * 2 *FRand() - 200000; 00060 RotationRate.Roll = 200000 * 2 *FRand() - 200000; 00061 DrawScale = FRand()*0.4 + 0.3; 00062 } 00063 } 00064 00065 defaultproperties 00066 { 00067 bNetOptional=True 00068 Physics=PHYS_Falling 00069 RemoteRole=ROLE_SimulatedProxy 00070 LifeSpan=3.000000 00071 DrawType=DT_Mesh 00072 Mesh=LodMesh'UnrealShare.ChipM' 00073 bUnlit=True 00074 bCollideWorld=True 00075 bBounce=True 00076 bFixedRotationDir=True 00077 }