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

UTDom.ControlPoint


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
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
/**
 * Control Point for Domination games
 * 
 * Writen by Brian 'Snake' Alexander. Copyright(c) 2007-2010 All Rights Reserved.
 */
class ControlPoint extends DominationObjective
   notplaceable
   hidedropdown;

/** Array of the staticmeshes that are display for the current controlling team. */
var const StaticMesh ControlPointMeshes[5]; 
/** Array of skins used for the DomBase mesh to match it's current state */
var const Material DomSkin[6]; 
/** Array of Higher detail skins to apply to the corresponding ControlPointMeshes of the same index */
var MaterialInstanceConstant MISkin[5]; 

simulated function PostBeginPlay()
{
   Super.PostBeginPlay();

   UpdateTeamEffects(4);
   // Set the initial light to be a little brighter
   DomLight.SetLightProperties(self.default.DomLight.Brightness+1.0);
   if (PointName ~= "")
      PointName = GetHumanReadableName();
}

function UpdateStatus()
{
   local TeamInfo NewTeam;
   local int OldIndex;

   if ( ControllingPawn == None )
      NewTeam = none;
   else
      NewTeam = ControllingPawn.PlayerReplicationInfo.Team;

   if ( NewTeam == ControllingTeam )
      return;

   // for AI, update DefenderTeamIndex
   OldIndex = DefenderTeamIndex;
   if (NewTeam == None)
   {
      DefenderTeamIndex = 255; // ie. "no team" since 0 is a valid team
      if (HomeBase != none)
         HomeBase.DefenderTeamIndex = 255;
   }
   else
   {
      DefenderTeamIndex = NewTeam.TeamIndex;
      if (HomeBase != none)
         HomeBase.DefenderTeamIndex = NewTeam.TeamIndex;
   }

   if (bScoreReady && (OldIndex != DefenderTeamIndex))
      UTGame(WorldInfo.Game).FindNewObjectives(HomeBase);

   // otherwise we have a new controlling team, or the point is being re-enabled
   ControllingTeam = NewTeam;
   super.UpdateStatus();

   // Change the displayed mesh to match the controlling team
   if (ControllingTeam == None)
   {
      bScoreReady = False;
      UpdateTeamEffects(4);
   }
   else
   {
      UpdateTeamEffects(ControllingTeam.TeamIndex);
      ScoreTime = 2;
      SetTimer(1.0, True);
   }
}

/** 
 * Changes the displayed mesh and light color to match the controlling team.
 * 
 * @param TeamIndex  The new controlling team to update to
 */
simulated function UpdateTeamEffects(byte TeamIndex)
{
   local byte i;

   super.UpdateTeamEffects(TeamIndex);

   i = static.ValidateTeamIndex(TeamIndex);
   DomMesh.SetStaticMesh(ControlPointMeshes[i]);
   // Apply the higher detail skins
   if (MISkin[i] != None)
      DomMesh.SetMaterial(0, MISkin[i]);

   // Fix up the mesh sizes, esp for the Green and Gold team meshes
   if (i == 2)
      DomMesh.SetScale(1.22);
   else if (i == 3)
      DomMesh.SetScale(1.36);
   else
      DomMesh.SetScale(1.08);

   DomLight.SetLightProperties(, LightColors[i]);
   ForceNetRelevant();
}

/** 
 * Don't call super here since we don't want it incrementing score! 
 */
function Timer()
{
   ScoreTime--;
   if (ScoreTime > 0)
   {
      bScoreReady = False;
   }
   else
   {
      ScoreTime = 0;
      bScoreReady = True;
      SetTimer(0.00000, False);
   }
}

function Reset()
{
   super.Reset();
   UpdateTeamEffects(4);
}

DefaultProperties
{
   ControlPointMeshes[0]=StaticMesh'DOM_Content.Meshes.DomRed'
   ControlPointMeshes[1]=StaticMesh'DOM_Content.Meshes.DomBlue'
   ControlPointMeshes[2]=StaticMesh'DOM_Content.Meshes.DomGreen'
   ControlPointMeshes[3]=StaticMesh'DOM_Content.Meshes.DomGold'
   ControlPointMeshes[4]=StaticMesh'DOM_Content.Meshes.DomN'
   MISkin[0]=MaterialInstanceConstant'DOM_Content.Materials.ControlPoint0_INST'
   MISkin[1]=MaterialInstanceConstant'DOM_Content.Materials.ControlPoint1_INST'
   MISkin[2]=MaterialInstanceConstant'DOM_Content.Materials.ControlPoint2_INST'
   MISkin[3]=MaterialInstanceConstant'DOM_Content.Materials.ControlPoint3_INST'
   MISkin[4]=MaterialInstanceConstant'DOM_Content.Materials.ControlPoint4_INST'
   Begin Object class=StaticMeshComponent name=StaticMeshComponent0
      StaticMesh=StaticMesh'DOM_Content.Meshes.DomN'
      CastShadow=False
      bCastDynamicShadow=False
      bAcceptsLights=False
      bAcceptsDynamicLights=False
      LightEnvironment=DomPointLightEnvironment
      CollideActors=False
      CullDistance=7000
      bUseAsOccluder=False
      BlockRigidBody=False
      Translation=(X=0.0,Y=0.0,Z=-24.0)
      Scale=1.08
   End Object
   DomMesh=StaticMeshComponent0
   Components.Add(StaticMeshComponent0)
   ControlSound=SoundCue'DOM_Content.Sounds.ControlSoundCue'
   MessageClass=class'UTDom.DOMMessage'
   bNoDelete=False
   Physics=PHYS_Rotating
   RotationRate=(Yaw=6000)
   DesiredRotation=(Yaw=30000)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 13/12/2010 01:43:18.000 - Creation time: Fri 23/12/2011 20:31:26.268 - Created with UnCodeX