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

ChristmasDecorationV2a.SantaHatAttachment


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

Creation date: 2010-12-12 16:37
Last change: $Id$
Copyright © 2010, Wormbo
Website: http://www.koehler-homepage.de/Wormbo/
Feel free to reuse this code. Send me a note if you found it helpful or want
to report bugs/provide improvements.
Please ask for permission first, if you intend to make money off reused code.
******************************************************************************/

class SantaHatAttachment extends StaticMeshActor notplaceable;


//=============================================================================
// Imports
//=============================================================================

#exec obj load file=SantaHat.usx package=ChristmasDecorationV2
#exec texture import file=Textures\SantaHatTexBlue.dds
#exec texture import file=Textures\SantaHatTexGreen.dds
#exec texture import file=Textures\SantaHatTexGold.dds


//=============================================================================
// Variables
//=============================================================================

var array<Material> TeamSkins;


simulated function PostNetBeginPlay()
{
	Super.PostNetBeginPlay();
	
    if (Level.Game != None)
		SetGRI(Level.Game.GameReplicationInfo);
	else if (Level.GRI != None)
		SetGRI(Level.GRI);
}


simulated function SetGRI(GameReplicationInfo GRI)
{
	local NavigationPoint NP;
	local GameObjective GO, BestGO;
	local float Dist, BestDist;
	local int TeamIndex;
	
	if (Owner != None && InStr(Locs(Owner.StaticMesh), "dead") != -1 && Owner.Skins.Length > 0)
	{
		TeamIndex = int(Right(Owner.Skins[0], 1));
		if (Right(Owner.Skins[0], 2) == ("_" $ TeamIndex))
		{
			Skins[0] = TeamSkins[TeamIndex];
			RepSkin = TeamSkins[TeamIndex];
			return;
		}
	}
	
	if (!GRI.bTeamGame || GRI.IsA('ASGameReplicationInfo'))
		return;
	
	for (NP = Level.NavigationPointList; NP != None; NP = NP.NextNavigationPoint)
	{
		GO = GameObjective(NP);
		if (GO != None && GO.DefenderTeamIndex < TeamSkins.Length && !GO.bTeamControlled)
		{
			Dist = VSize(Location - GO.Location);
			if (BestGO == None || Dist < BestDist)
			{
				BestGO = GO;
				Bestdist = Dist;
			}
		}
	}
	
	if (BestGO != None && BestGO.DefenderTeamIndex < TeamSkins.Length)
	{
		Skins[0] = TeamSkins[BestGO.DefenderTeamIndex];
		RepSkin = TeamSkins[BestGO.DefenderTeamIndex];
	}
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
	DrawType    = DT_StaticMesh
	StaticMesh  = StaticMesh'SantaHatSM'
	RemoteRole  = ROLE_None
	bHardAttach = True
	MaxLights   = 8
	bStasis     = True
	bStatic     = False
	bNoDelete   = False
	bOnlyDrawIfAttached = True
	
	TeamSkins(0) = Texture'SantaHatTex'
	TeamSkins(1) = Texture'SantaHatTexBlue'
	TeamSkins(2) = Texture'SantaHatTexGreen'
	TeamSkins(3) = Texture'SantaHatTexGold'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 10.11.2013 18:10:20.000 - Creation time: Do 14.8.2014 09:58:49.298 - Created with UnCodeX