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

UTGame.UTGreedCoin


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
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */
class UTGreedCoin extends UTDroppedItemPickup
	abstract;

/** Number of points this coin is worth when returned */
var int Value;

/** Effects Template */
var ParticleSystem TrailTemplate;
/** This is the effect that is played while in flight */
var ParticleSystemComponent	TrailEffects;
/** Scaling for the in-flight trail effects */
var float TrailEffectScale;

var TextureCoordinates CoinIconCoords;

var SoundCue BounceSound;

var ForceFeedbackWaveform PickUpWaveForm;

var LinearColor SkullColor;


simulated function PostBeginPlay()
{
	Super.PostBeginPlay();

	// Particle trail setup
	if (WorldInfo.NetMode != NM_DedicatedServer && TrailTemplate != None)
	{
		TrailEffects = WorldInfo.MyEmitterPool.SpawnEmitterCustomLifetime(TrailTemplate);
		if (TrailEffects != None)
		{
			TrailEffects.SetAbsolute(false, false, false);
			TrailEffects.SetLODLevel(WorldInfo.bDropDetail ? 1 : 0);
			//TrailEffects.OnSystemFinished = MyOnParticleSystemFinished;
			TrailEffects.bUpdateComponentInTick = true;
			TrailEffects.SetScale(TrailEffectScale);
			AttachComponent(TrailEffects);
		}
	}
}

/** Add this coin's value to the pawn */
function GiveTo( Pawn P )
{
	local UTPawn UTP;
	local UTPlayerController PC;
	local UTPlayerReplicationInfo PRI;
	local UTHUD HUD;

	UTP = UTPawn(P);
	if (UTP != None)
	{
		PRI = UTPlayerReplicationInfo(UTP.PlayerReplicationInfo);
		if (PRI != None)
		{
			PRI.AddCoins(Value);
		}
	}
	PickedUpBy(P);

	PC = UTPlayerController(P.Controller);
	if (PC != None)
	{
		PC.CheckAutoObjective(false);

		// Inform the HUD of the pickup time, for crosshair scaling
		HUD = UTHUD(PC.myHUD);
		if (HUD != None)
		{
			HUD.LastPickupTime = HUD.WorldInfo.TimeSeconds;
		}

		PC.ClientPlayForceFeedbackWaveform(PickUpWaveForm);
	}
}

/** Disable particle effects upon landing */
simulated event Landed(vector HitNormal, Actor FloorActor)
{
	local PrimitiveComponent RealPickupMesh;

	RealPickupMesh = PickupMesh;
	PickupMesh = None; // prevent mesh adjustment
	Super.Landed(HitNormal, FloorActor);
	PickupMesh = RealPickupMesh;
	
	// clear component and return to pool
	if (TrailEffects != None)
	{
		TrailEffects.DeactivateSystem();
		DetachComponent(TrailEffects);
		WorldInfo.MyEmitterPool.OnParticleSystemFinished(TrailEffects);
		TrailEffects = None;
	}
	SetPhysics(PHYS_None);
}

/**
* Give a little bounce
*/
simulated event HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp)
{
	local float Speed;

	// check to make sure we didn't hit a pawn
	if ( Pawn(Wall) == none )
	{
		Velocity = 0.6*(( Velocity dot HitNormal ) * HitNormal * -2.0 + Velocity);   // Reflect off Wall w/damping
		Speed = VSize(Velocity);

		if (Velocity.Z > 400)
		{
			Velocity.Z = 0.5 * (400 + Velocity.Z);
		}

		// Only play the bounce sound if the skull is moving fast
		if (Speed > 40.0)
		{
			if ( WorldInfo.NetMode != NM_DedicatedServer )
			{
				PlaySound(BounceSound);
			}
		}
		// If the skull is moving slowly, clear the trail effect
		else 
		{
			bBounce = false;
			Landed(HitNormal, Wall);
		}
	}
}

/** Slow down skulls that enter water */
simulated function PhysicsVolumeChange( PhysicsVolume NewVolume )
{
	if ( WaterVolume(NewVolume) != none )
	{
		Velocity *= 0.25;
	}

	Super.PhysicsVolumeChange(NewVolume);
}

function float BotDesireability(Pawn Bot, Controller C)
{
	local UTPlayerReplicationInfo PRI;
	local float ValueMult;

	// don't chase coins that haven't landed yet
	if ( Physics != PHYS_None )
	{
		return 0;
	}

	// Desire based on coins already held and value of this one
	PRI = UTPlayerReplicationInfo(C.PlayerReplicationInfo);
	ValueMult = (PRI == None) ? 0.2 : FMax(0.2, 8.0/(7.0+PRI.GetNumCoins()));
	return FClamp(ValueMult * float(Value), 0.4, 1.5);
}


State FadeOut
{
	simulated function BeginState(Name PreviousStateName)
	{
		bFadeOut = true; 
		if ( PickupMesh != None )
		{
			StartScale = PickupMesh.Scale;
		}

		if( PickupParticles != None )
		{
			PickupParticles.DeactivateSystem();
		}

		LifeSpan = 2.0;
		YawRotationRate = 60000;
	}
}

defaultproperties
{
   TrailEffectScale=0.300000
   CoinIconCoords=(U=223.000000,V=49.000000,UL=36.000000,VL=36.000000)
   SkullColor=(R=0.000000,G=0.000000,B=0.000000,A=1.000000)
   Begin Object Class=DynamicLightEnvironmentComponent Name=DroppedPickupLightEnvironment ObjName=DroppedPickupLightEnvironment Archetype=DynamicLightEnvironmentComponent'UTGame.Default__UTDroppedItemPickup:DroppedPickupLightEnvironment'
      ObjectArchetype=DynamicLightEnvironmentComponent'UTGame.Default__UTDroppedItemPickup:DroppedPickupLightEnvironment'
   End Object
   MyLightEnvironment=DroppedPickupLightEnvironment
   Begin Object Class=SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'UTGame.Default__UTDroppedItemPickup:Sprite'
      ObjectArchetype=SpriteComponent'UTGame.Default__UTDroppedItemPickup:Sprite'
   End Object
   Components(0)=Sprite
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTDroppedItemPickup:CollisionCylinder'
      ObjectArchetype=CylinderComponent'UTGame.Default__UTDroppedItemPickup:CollisionCylinder'
   End Object
   Components(1)=CollisionCylinder
   Components(2)=DroppedPickupLightEnvironment
   TickGroup=TG_PostAsyncWork
   bBounce=True
   CollisionComponent=CollisionCylinder
   Name="Default__UTGreedCoin"
   ObjectArchetype=UTDroppedItemPickup'UTGame.Default__UTDroppedItemPickup'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:46.000 - Creation time: sk 18-3-2018 10:01:21.421 - Created with UnCodeX