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

UTDom.xDomPoint


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
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
/**
 * xDomPoint.  Base class of Domination Points For Double Domination (DoubleDom) matches.
 * 
 * Writen by Brian 'Snake' Alexander. Copyright(c) 2007-2010 All Rights Reserved.
 */
class xDomPoint extends ControlPoint
   abstract;

delegate ResetCount();

simulated function PostNetReceive()
{
   if( !bScoreReady )
      UpdateTeamEffects(5);
   else if ( ControllingTeam == None )
      UpdateTeamEffects(4);
   else
      UpdateTeamEffects(ControllingTeam.TeamIndex);
}

/**
 * TeamIndex=0 red
 * TeamIndex=1 blue
 * TeamIndex=2 green
 * TeamIndex=3 gold
 * TeamIndex=4 neutral
 * TeamIndex=5 disabled
 */
simulated function UpdateTeamEffects(byte TeamIndex)
{
   local byte i;

   super(DominationObjective).UpdateTeamEffects(TeamIndex);

   if (TeamIndex >= 5)
   {
      // Diabled
      bIsDisabled = True;
      bIsActive = False;

      DomLight.SetEnabled(false);
      DomMesh.SetMaterial(0,DomSkin[5]);
      if (DomLetter != none)
         DomLetter.SetHidden(true);

      if (DomRing != none)
         DomRing.SetHidden(true);
   }
   else
   {
      bIsDisabled = false;
      bIsActive = true;

      i = static.ValidateTeamIndex(TeamIndex);
      DomLight.SetEnabled(true);
      DomLight.SetLightProperties(4, LightColors[i]);
      DomMesh.SetMaterial(0,DomSkin[i]);
      if (DomLetter != none)
      {
         DomLetter.SetDomMaterial(i);
         if ( DomLetter.bHidden )
            DomLetter.SetHidden(false);
      }

      if (DomRing != none)
      {
         DomRing.SetDomMaterial(i);
         if ( DomRing.bHidden )
            DomRing.SetHidden(false);
      }
   }
   bForceNetUpdate = True;
}

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

   // who is the current controlling team of this domination point?
   if (ControllingPawn == None)
      NewTeam = None;
   else
      NewTeam = ControllingPawn.PlayerReplicationInfo.Team;

   // do nothing if there is no change in the controlling team (and there is a controlling team)
   if ((NewTeam == ControllingTeam) && (NewTeam != None))
      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(Self);

   // otherwise we have a new controlling team, or the domination point is being re-enabled
   ControllingTeam = NewTeam;
   super(DominationObjective).UpdateStatus();
   if (ControllingTeam != None)
   {
      SetAlarm(true);
   }
   ResetCount();

   if (ControllingTeam == None)
   {
      // goes dark while untouchable (disabled) after a score
      if (!bScoreReady)
         UpdateTeamEffects(5);
      else if (bScoreReady) // goes back to white when neutral again
         UpdateTeamEffects(4);
   }
   else
   {
      UpdateTeamEffects(ControllingTeam.TeamIndex);
   }
}

function ResetPoint(bool IsEnabled)
{
   if ( !bScoreReady && IsEnabled )
      UTGame(WorldInfo.Game).FindNewObjectives(Self);

   bScoreReady = IsEnabled;
   if ( IsEnabled )
   {
      Enable('Touch');
      Enable('UnTouch');
   }
   else
   {
      Disable('Touch');
      Disable('UnTouch');
   }

   ControllingPawn = None;
   ControllingTeam = None;
   HolderPRI = None;
   UpdateStatus();
   bForceNetUpdate = True;
}

simulated function SetAlarm(bool bNowOn)
{
   super.SetAlarm(bNowOn);
   if (WorldInfo.NetMode != NM_DedicatedServer)
   {
      if (bNowOn)
      {
         if (AlarmSound != none)
         {
            SetTimer(5.0,false);
            AlarmSound.Play();
         }
      }
      else
      {
         if (AlarmSound != none)
            AlarmSound.Stop();
      }
   }
}

/**
 * don't call super here since we don't want it incrementing score! 
 */
simulated function Timer()
{
   SetAlarm(false);
}

simulated function vector GetHUDOffset(PlayerController PC, Canvas Canvas)
{
   local float Z;

   Z = 60;
   if ( PC.ViewTarget != None )
   {
      Z += 0.1 * VSize(PC.ViewTarget.Location - Location);
   }
   return Z*vect(0,0,1);
}

DefaultProperties
{
   DomSkin[0]=Material'DOM_Content.Materials.DDom.DomPoint_Red_Mat'
   DomSkin[1]=Material'DOM_Content.Materials.DDom.DomPoint_Blue_Mat'
   DomSkin[2]=Material'DOM_Content.Materials.DDom.DomPoint_Green_Mat'
   DomSkin[3]=Material'DOM_Content.Materials.DDom.DomPoint_Gold_Mat'
   DomSkin[4]=Material'DOM_Content.Materials.DDom.DomPoint_Neutral_Mat'
   DomSkin[5]=Material'DOM_Content.Materials.DDom.DomPoint_Disabled_Mat'
   Begin Object Name=CollisionCylinder
      CollisionRadius=+70.0
   End Object
   CollisionType=COLLIDE_TouchAll
   CollisionComponent=CollisionCylinder
   Components.Add(CollisionCylinder)
   Begin Object Name=StaticMeshComponent0
      StaticMesh=StaticMesh'DOM_Content.Meshes.DomPointBaseLower'
      Translation=(X=0.0,Y=0.0,Z=-4.0)
      bAcceptsLights=True
      bAcceptsDynamicLights=True
      LightingChannels=(BSP=True,Dynamic=True,Static=True)
      LightEnvironment=DomPointLightEnvironment
   End Object
   DomMesh=StaticMeshComponent0
   Components.Add(StaticMeshComponent0)
   Begin Object Class=AudioComponent Name=AlarmSoundComponent
      SoundCue=SoundCue'A_Gameplay.CTF.Cue.A_Gameplay_CTF_FlagAlarm_Cue'
   End Object
   AlarmSound=AlarmSoundComponent
   ControlSound=None
   MessageClass=None
   Physics=PHYS_None
   RotationRate=(Yaw=0)
   DesiredRotation=(Yaw=0)
   bHidden=False
   DrawScale=0.6
   EffectOffset=(X=0.0,Y=0.0,Z=40.0)
}

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