SpatialFear.SFFoodHealth

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
//=============================================================================
// Spatial Fear
// Class: SFFoodHealth
// Description: Abstract base class for all food health pickups
//		The pickups will not remove the modell, but play a different animation
//
//
// Author: Markus Nuebel
//=============================================================================

class SFFoodHealth extends SFHealth
	abstract;

var (SpatialFear) name	nameStartAnim; // Name of the starting animation. Before the health item is being used.
var (SpatialFear) name	nameEndAnim; // Name of the ending animation. After the health item has been used.
var (SpatialFear) float fTweenTime; // How long it takes to tween from the start animaion to the end animation. (in seconds). Default: 1.0

var bool m_bUsed; // Private: Shows, if the items has already been used. Default: false

auto state Pickup
{	
	// Touch the health and pick it up
	function Touch( actor Other )
	{
		local int HealMax;
		local Pawn P;
			
		if ( ValidTouch(Other) && !m_bUsed) 
		{	

			P = Pawn(Other);	
			HealMax = P.default.health;

			if (P.Health < HealMax) 
			{
				// Mark as used
				m_bUsed=true;

				P.Health += HealingAmount;

				if (P.Health > HealMax) 
					P.Health = HealMax;

				PlayPickupMessage(P);
				PlaySound (PickupSound,,2.5);
				Other.MakeNoise(0.2);		

				// No resawn, play another animation
				// SetRespawn();
				LoopAnim(nameStartAnim);
				TweenAnim(nameEndAnim, fTweenTime);
			}
		}
	}
}

defaultproperties
{
     nameStartAnim='
     nameEndAnim='
     fTweenTime=1.000000
     PickupMessage="You picked up a some food +"
}

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:44 PM
Created with UnCodeX