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

UnrealI.Bloblet


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
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
//=============================================================================
// Bloblet.
// Must tag with same tag as a Blob
//=============================================================================
class Bloblet expands FlockPawn;

#exec MESH IMPORT MESH=MiniBlob ANIVFILE=MODELS\MiniB_a.3D DATAFILE=MODELS\MiniB_d.3D ZEROTEX=1
#exec MESH ORIGIN MESH=MiniBlob X=0 Y=-100 Z=0 YAW=64 ROll=-64

#exec MESH SEQUENCE MESH=MiniBlob SEQ=All    STARTFRAME=0   NUMFRAMES=75
#exec MESH SEQUENCE MESH=MiniBlob SEQ=Glob1  STARTFRAME=0   NUMFRAMES=10
#exec MESH SEQUENCE MESH=MiniBlob SEQ=Glob2  STARTFRAME=10   NUMFRAMES=10
#exec MESH SEQUENCE MESH=MiniBlob SEQ=Glob3  STARTFRAME=20   NUMFRAMES=15
#exec MESH SEQUENCE MESH=MiniBlob SEQ=GlobProj  STARTFRAME=35   NUMFRAMES=20
#exec MESH SEQUENCE MESH=MiniBlob SEQ=Splat  STARTFRAME=55   NUMFRAMES=20
#exec MESH SEQUENCE MESH=MiniBlob SEQ=Flat   STARTFRAME=62   NUMFRAMES=1

#exec TEXTURE IMPORT NAME=JBlob1 FILE=MODELS\bloblet.PCX GROUP=Skins 
#exec MESHMAP SCALE MESHMAP=MiniBlob X=0.06 Y=0.06 Z=0.12
#exec MESHMAP SETTEXTURE MESHMAP=MiniBlob NUM=0 TEXTURE=Jblob1

#exec AUDIO IMPORT FILE="Sounds\Blob\death1Bl.WAV" NAME="BlobDeath" GROUP="Blob"
#exec AUDIO IMPORT FILE="Sounds\BRifle\GelHit1.WAV" NAME="GelHit" GROUP="BioRifle"
#exec AUDIO IMPORT FILE="Sounds\Blob\goop2Bl.WAV" NAME="BlobGoop1" GROUP="Blob"
#exec AUDIO IMPORT FILE="Sounds\Blob\goop3Bl.WAV" NAME="BlobGoop2" GROUP="Blob"
#exec AUDIO IMPORT FILE="Sounds\Blob\goop4Bl.WAV" NAME="BlobGoop3" GROUP="Blob"
#exec AUDIO IMPORT FILE="Sounds\Blob\hit1Bl.WAV" NAME="BlobHit" GROUP="Blob"
#exec AUDIO IMPORT FILE="Sounds\Blob\injur1Bl.WAV" NAME="BlobInjur" GROUP="Blob"

var parentBlob parentBlob;
var vector  Orientation;
var float   LastParentTime;

function PostBeginPlay()
{
    Super.PostBeginPlay();
    DrawScale = 0.8 + 0.4 * FRand();
}

function Died(pawn Killer, name damageType, vector HitLocation)
{
    PlaySound(Die);
    SetCollision(false,false, false);
    parentBlob.shrink(self);
    GotoState('DiedState');
}

function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
                        Vector momentum, name damageType)
{
    local rotator newRotation;
    local GreenSmokePuff f;

    if (damageType == 'corroded')
        return;
    PlaySound(HitSound1);
    f = spawn(class'GreenSmokePuff',,,Location - Normal(Momentum)*12); 
    f.DrawScale = FClamp(0.1 * Damage, 1.0, 4.0);
    SetPhysics(PHYS_Falling);
    newRotation = Rotation;
    newRotation.Roll = 0;
    setRotation(newRotation);
    Super.TakeDamage(Damage,instigatedBy,hitLocation,momentum,damageType);  
}

function BaseChange()
{
}

function wakeup()
{
    GotoState('Active');
}

function PreSetMovement()
{
    bCanWalk = true;
    bCanSwim = true;
    bCanFly = false;
    MinHitWall = -0.7;
}


function Timer()
{
    local int i;
    local bool bHasEnemy;

    bHasEnemy = ((parentBlob != None) && (parentBlob.Enemy != None));
    if ( bHasEnemy && (VSize(Location - parentBlob.Enemy.Location) < parentBlob.Enemy.CollisionHeight + CollisionRadius) )
    {
        parentBlob.Enemy.TakeDamage(18 * FRand(), parentBlob, location, vect(0,0,0), 'corroded');
        PlaySound(sound'BlobHit');
    }
    
    if ( Physics == PHYS_Spider )
    {
        if ( FRand() < 0.33 )
            PlaySound(sound'BlobGoop1');
        else if ( FRand() < 0.5 )
            PlaySound(sound'BlobGoop2');
        else
            PlaySound(sound'BlobGoop3');
    }
    if ( bHasEnemy )
        SetTimer(0.5 + 0.5 * FRand(), false);
    else
        SetTimer(1 + FRand(), false);   
}
     
function PlayGlob(float rate)
{
    if (FRand() < 0.75)
        LoopAnim('Glob1', rate * 0.7 * FRand());
    else
        LoopAnim('Glob3', rate * (0.5 + 0.5 * FRand()));
}

auto state asleep
{
    function Landed(vector HitNormal)
    {
        if ( !FootRegion.Zone.bWaterZone )
            PlaySound(Land);
        PlayAnim('Splat');
        SetPhysics(PHYS_None);
    }   
    
Begin:
    SetTimer(2 * FRand(), false);
    if (Physics != PHYS_Falling)
        SetPhysics(PHYS_None);
    PlayGlob(0.3);
}

state active
{
    function AnimEnd()
    {
        playGlob(1);
    }

    function Landed(vector HitNormal)
    {
        SetRotation(Rot(0,0,0));
        if ( Velocity.Z > 200 )
        {
            PlayAnim('Splat');
            PlaySound(Land);
        }
        SetPhysics(PHYS_Spider);
    }

begin:
    SetTimer(FRand(), false);
    SetPhysics(PHYS_Spider);
    PlayGlob(1);
    LastParentTime = Level.TimeSeconds;

wander:
    if (parentBlob == None)
        GotoState('DiedState');
    if ( VSize(Location - parentBlob.Location) > 120 )
    {
        if ( LastParentTime - Level.TimeSeconds > 20 )
            GotoState('DiedState');
        else    
            MoveToward(parentBlob);
    }
    else 
    {
        LastParentTime = Level.TimeSeconds;
        MoveTo(ParentBlob.Location);
    }
    Sleep(0.1);
    Goto('Wander');
}


state fired
{
    function HitWall(vector HitNormal, actor Wall)
    {
        PlaySound(Land);
        GotoState('Active');
    }

    function Landed(vector HitNormal)
    {
        if ( !FootRegion.Zone.bWaterZone )
            PlaySound(Land);
        GotoState('Active');
    }
}

state DiedState
{
    ignores TakeDamage;

    function Landed(vector HitNormal)
    {
        if ( !FootRegion.Zone.bWaterZone )
            PlaySound(Land);
        SetRotation(Rot(0,0,0));
        PlayAnim('Splat');
        SetPhysics(PHYS_None);
    }   

    function Tick(float DeltaTime)
    {
        DrawScale = DrawScale - 0.06 * DeltaTime;
        if (DrawScale < 0.1)
            Destroy();
    }

Begin:
    SetPhysics(PHYS_Falling);
    PlayAnim('Splat');
    FinishAnim();
    TweenAnim('Flat', 0.2);
}   

    

defaultproperties
{
     GroundSpeed=450.000000
     AccelRate=1200.000000
     JumpZ=-1.000000
     SightRadius=4100.000000
     Health=120
     ReducedDamageType=exploded
     ReducedDamagePct=0.250000
     HitSound1=Sound'UnrealI.Blob.BlobInjur'
     Land=Sound'UnrealShare.BioRifle.GelHit'
     Die=Sound'UnrealI.Blob.BlobDeath'
     Tag=blob1
     DrawType=DT_Mesh
     Texture=Texture'UnrealI.Skins.JBlob1'
     Mesh=Mesh'UnrealI.MiniBlob'
     bMeshEnviroMap=True
     CollisionRadius=6.000000
     CollisionHeight=6.000000
     bBlockActors=False
     bBlockPlayers=False
     Mass=40.000000
     RotationRate=(Pitch=0,Yaw=0,Roll=0)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 21/2/2010 23:48:40.000 - Creation time: Sun 21/2/2010 23:49:51.212 - Created with UnCodeX