1. 2012.07.04 ¶
// EmeraldStage/ESGameInfo.uc class ESGameInfo extends UTDeathmatch; // definition of member variable, assigning value is done at defaultproperties function var int a;[[Media(Example.mp3)]] // Its behavior is similarly to constructor. DefaultProperties { // Extend PlayerController class to custom class PlayerControllerClass = class'ESPlayerController'; } // Event occured when character logged in(or creation). There are existing function PreLogin, PostLogin functions. event PlayerController Login(string portal, string options, const UniqueNetId uniqueID, out string errorMsg) { local PlayerController pc; pc = super.Login(portal, options, uniqueID, errorMsg); return pc; } event PostLogin(PlayerController pc) { `log("Hello World!"); `log(pc.Name@"logged in"); super.PostLogin(pc); }
// EmeraldStage/ESPlayerController.uc class ESPlayerController extends UTPlayerController; DefaultProperties { } event Tick(float deltaTime) { // called every update time `log("tick!"); }
2. 2012.07.10 카메라 소스 ¶
// ESPlayerPawn.uc simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV ) { local vector CamStart, HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ, CurrentCamOffset; local float DesiredCameraZOffset; CamStart = self.Location; CurrentCamOffset = self.CamOffset; DesiredCameraZOffset = (Health > 0) ? - 1.2 * GetCollisionHeight() + Mesh.Translation.Z : 0.f; CameraZOffset = (fDeltaTime < 0.2) ? - DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset; if ( Health <= 0 ) { CurrentCamOffset = vect(0,0,0); CurrentCamOffset.X = GetCollisionRadius(); } CamStart.Z += CameraZOffset; GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ); CamDirX *= CurrentCameraScale; if ( (Health <= 0) || bFeigningDeath ) { // Move camera to prevent pinning by world // @todo fixmesteve. If FindSpot fails, then (rarely does) camera pinned continously. FindSpot(GetCollisionExtent(), CamStart); } if (CurrentCameraScale < CameraScale) { CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime); } else if (CurrentCameraScale > CameraScale) { CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime); } if (CamDirX.Z > GetCollisionHeight()) { CamDirX *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536 } out_CamLoc = CamStart - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ; if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None) { out_CamLoc = HitLocation; } return true; }
3. 2012.07.16 간단한 문자열 연결 kismet 소스 ¶
class SeqAct_ConcatenateStrings extends SequenceAction; var() String ValueA; var() String ValueB; var() bool ConcatenateWithSpace; var string StringResult; event Activated() { StringResult = (ConcatenateWithSpace) ? ValueA@ValueB : ValueA$ValueB; ActivateOutputLink(0); } defaultproperties { ObjName="Concatenate Strings" ObjCategory="Misc" InputLinks(0)=(LinkDesc="In") OutputLinks(0)=(LinkDesc="Out") VariableLinks.Empty VariableLinks(0)=(ExpectedType=class'SeqVar_String',LinkDesc="A",PropertyName=ValueA) VariableLinks(1)=(ExpectedType=class'SeqVar_String',LinkDesc="B",PropertyName=ValueB) VariableLinks(2)=(ExpectedType=class'SeqVar_String',LinkDesc="StringResult",bWriteable=true,PropertyName=StringResult) }