Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Copyright 2005-2012 Daniel Batten (MonsOlympus), All Rights Reserved.
- */
- class Plugin_Component extends ActorComponent;
- //var GameInfo Game; //TODO: Could attach this to GameInfo Components, Track which volume this is in on server side, this list will be smaller than Pawn/Controller
- var private bool bActive;
- var private float Tickrate, //The rate at which ticks are counted.
- Ticks, //The amount of lifetime that has passed.
- Lifetime; //The total amount of lifetime for this component.
- simulated function PostBeginPlay()
- {
- SetActive(bActive);
- }
- function SetRate(float NewTickRate)
- {
- local bool bOldActive;
- bOldActive=bActive;
- SetActive(!bActive);
- Tickrate=NewTickRate;
- SetActive(bOldActive);
- }
- function SetLifetime(float NewLifetime)
- {
- local bool bOldActive;
- /*local float OldLifetime;
- OldLifetime=Lifetime;
- if(NewLifetime > Lifetime){
- // Lifetime-NewLifetime;
- }else{
- }*/
- bOldActive=bActive;
- SetActive(!bActive);
- // Tickrate=NewTickRate;
- SetActive(bOldActive);
- }
- function SetActive(bool bOn)
- {
- if(Owner != None)
- {
- if(bOn)
- Owner.SetTimer(TickRate, True, 'Timer', Self);
- else
- Owner.ClearTimer('Timer', Self);
- }
- }
- function Timer()
- {
- if((Lifetime != 0 && Ticks >= Lifetime) || !bActive)
- {
- Owner.ClearTimer('Timer', Self);
- DetachFromAny();
- }
- /* if(TickRate != default.TickRate){SetTimer(default.TickRate, True, 'Timer', Self);}*/
- Ticks+=Tickrate;
- }
- defaultproperties
- {
- bNeedsUpdateTransform=false
- Tickrate=0.01
- Lifetime=10.0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement