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

KFStoryGame.ObjCondition_Timed


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
/*
	--------------------------------------------------------------
	Condition_Timed
	--------------------------------------------------------------

    A Condition which is marked complete after a specified amount of
    time expires.

	Author :  Alex Quick

	--------------------------------------------------------------
*/

class ObjCondition_Timed extends KF_ObjectiveCondition
editinlinenew;

var                        bool                       bTraderTime;

var ()                     float                      Duration;

var                        float                      RemainingSeconds;

var                        float                      StartTime;

function AdjustToDifficulty(float Difficulty)
{
    Duration /= FMax(Difficulty-2,1);
}

function Reset()
{
    Super.Reset();
    StartTime = 0.f;
    RemainingSeconds = Duration;
}

function ConditionActivated(pawn ActivatingPlayer)
{
    Super.ConditionActivated(ActivatingPlayer);
//    log("======================"@self@"was just activated by : "@ActivatingPlayer,'Story_Debug');
    RemainingSeconds = Duration ;
    StartTime = GetObjOwner().Level.TimeSeconds ;
}

/* returns the percentage of completion for this condition */
function       float        GetCompletionPct()
{
     return    FClamp(1.f- (RemainingSeconds / Duration),0.f,1.f);
}

function ConditionTick(float DeltaTime)
{
    local float NewTimeRemaining;

    if(RemainingSeconds > 0)
    {
        NewTimeRemaining = FMax(Duration - int(GetObjOwner().Level.TimeSeconds - StartTime),0) ;
        RemainingSeconds = NewTimeRemaining;
    }

    Super.ConditionTick(DeltaTime);
}

function        string      GetDataString()
{
     if(HUD_Screen.Screen_CountStyle == Count_Down)
     {
        return FormatTime(RemainingSeconds) ;
     }
     else
     {
        return FormatTime(GetObjOwner().Level.TimeSeconds - StartTime) ;
     }
}

defaultproperties
{
     Duration=60.000000
     HUD_Screen=(Screen_Hint="Time Left :",Screen_CountStyle=Count_Down,Screen_ProgressStyle=HDS_TextOnly)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fri 13-10-2023 03:17:28.000 - Creation time: Fri 13-10-2023 03:19:06.031 - Created with UnCodeX