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

UTDom.DOMTeamStaticMesh


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
/**
 * More advanced UTTeamStaticMesh. The exact UTGameObjective actor that will be monitoring, can be manualy set.
 * No longer limited to only the 0 index to change the material on.
 *
 * Setup the TeamMaterials array using the following format:
 *  TeamMaterials[0]=Red Team
 *  TeamMaterials[1]=Blue Team
 *  TeamMaterials[2]=Green Team
 *  TeamMaterials[3]=Gold Team
 *  TeamMaterials[4]=Neutral
 *
 * Writen by Brian 'Snake' Alexander. Copyright(c) 2007-2010 All Rights Reserved.
 */
class DOMTeamStaticMesh extends UTTeamStaticMesh;

/** The UTGameObjective this actor will be associated with. If this value is 'none', Default to the nearest UTGameObjective. */
var() UTGameObjective TheObjective;
/** The index of the skin to apply the TeamMaterials on. Default is 0 */
var() int TeamMeshSkinIndex;

simulated event PreBeginPlay()
{
   local UTGameObjective O, Best;
   local float Distance, BestDistance;

   if (WorldInfo.NetMode != NM_DedicatedServer)
   {
      if (TheObjective != none)
         Best = TheObjective;
      else
      {
         BestDistance = 1000000.f;
         foreach WorldInfo.AllNavigationPoints(class'UTGameObjective', O)
         {
            Distance = VSize(Location - O.Location);
            if (Distance < BestDistance)
            {
               BestDistance = Distance;
               Best = O;
            }
         }
      }

      if (Best != None)
      {
         Best.AddTeamStaticMesh(self);
      }
      else
      {
         SetTeamNum(255);
      }
   }
}

simulated function SetTeamNum(byte NewTeam)
{
   local int i;

   if (WorldInfo.NetMode != NM_DedicatedServer)
   {
      i = 0;
      if ( TeamMeshSkinIndex <= StaticMeshComponent.GetNumElements() )
      {
         i = TeamMeshSkinIndex;
      }
      else
      {
         `Warn(string(self)$" - TeamMeshSkinIndex is Not a valid ElementIndex!  "$TeamMeshSkinIndex$"/"$StaticMeshComponent.GetNumElements());
      }

      if (NewTeam < TeamMaterials.length)
      {
         StaticMeshComponent.SetMaterial(i, TeamMaterials[NewTeam]);
      }
      else
      {
         StaticMeshComponent.SetMaterial(i, NeutralMaterial);
      }
   }
}

DefaultProperties
{
   TeamMeshSkinIndex=0
   // pre-size array to five elements for convenience
   TeamMaterials[0]=None
   TeamMaterials[1]=None
   TeamMaterials[2]=None
   TeamMaterials[3]=None
   TeamMaterials[4]=None
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Wed 8/12/2010 21:20:32.000 - Creation time: Fri 23/12/2011 20:31:26.395 - Created with UnCodeX