Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. */ /** this is used when to hold constructed character data temporarily when a PRI is destroyed, so that if the same character comes back * shortly afterward (e.g. because the PRI was getting replaced via seamless travel) the mesh doesn't need to be re-created */ class UTProcessedCharacterCache extends Actor; /** data for the character this player is using */ var CustomCharData CharacterData; /** the mesh constructed from the above data */ var SkeletalMesh CharacterMesh; /** Texture of render of custom character head. */ var Texture CharPortrait; /** Materials related to team skins */ var MaterialInstanceConstant RedHeadMIC; var MaterialInstanceConstant RedBodyMIC; var MaterialInstanceConstant BlueHeadMIC; var MaterialInstanceConstant BlueBodyMIC; /** Mesh to use for first person arms. Should only be present for local players! */ var SkeletalMesh FirstPersonArmMesh; /** Material applied to first person arms. Should only be present for local players! */ var MaterialInterface FirstPersonArmMaterial; /** team the player was on */ var byte TeamIndex; static function bool ShouldCacheCharacter(UTPlayerReplicationInfo PRI) { return ( PRI.CharacterMesh != None || PRI.CharPortrait != PRI.default.CharPortrait || PRI.FirstPersonArmMesh != None || PRI.FirstPersonArmMaterial != None ); } /** caches the character data from the specified PRI */ function CachePRICharacter(UTPlayerReplicationInfo PRI) { CharacterData = PRI.CharacterData; CharacterMesh = PRI.CharacterMesh; RedBodyMIC = PRI.RedBodyMIC; RedHeadMIC = PRI.RedHeadMIC; BlueBodyMIC = PRI.BlueBodyMIC; BlueHeadMIC = PRI.BlueHeadMIC; CharPortrait = PRI.CharPortrait; FirstPersonArmMesh = PRI.FirstPersonArmMesh; FirstPersonArmMaterial = PRI.FirstPersonArmMaterial; TeamIndex = PRI.GetTeamNum(); } /** if the PRI's character data matches, updates the PRI then destroys the cache object * @return whether the data matched */ function bool GetCachedCharacter(UTPlayerReplicationInfo PRI) { if (PRI.CharacterData != CharacterData) { return false; } else if (PRI.GetTeamNum() != TeamIndex) { // if the PRI has no team at all and might get one, wait a bit and retry if (PRI.Team == None && (WorldInfo.GRI == None || WorldInfo.GRI.GameClass == None || WorldInfo.GRI.GameClass.default.bTeamGame)) { PRI.SetTimer(LifeSpan + 0.5, false, 'RetryProcessCharacterData'); return true; } else { return false; } } else { PRI.SetCharacterMesh(CharacterMesh); //Restore materials after setting the character mesh (SetCharacterMesh will None them) PRI.RedBodyMIC = RedBodyMIC; PRI.RedHeadMIC = RedHeadMIC; PRI.BlueBodyMIC = BlueBodyMIC; PRI.BlueHeadMIC = BlueHeadMIC; PRI.CharPortrait = CharPortrait; PRI.SetFirstPersonArmInfo(FirstPersonArmMesh, FirstPersonArmMaterial); Destroy(); return true; } } event Destroyed() { Super.Destroyed(); // if we were destroyed because the data was unclaimed, GC immediately to recover the memory if (LifeSpan <= 0.0) { WorldInfo.ForceGarbageCollection(); } } defaultproperties { bGameRelevant=True LifeSpan=15.000000 CollisionType=COLLIDE_CustomDefault Name="Default__UTProcessedCharacterCache" ObjectArchetype=Actor'Engine.Default__Actor' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |