## XIDCine
Class BeachInBedWithXIII

source: C:\XIII\XIDCine\Classes\BeachInBedWithXIII.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Triggers
             |
             +--XIDCine.BeachInBedWithXIII

Direct Known Subclasses:None

class BeachInBedWithXIII
extends Engine.Triggers

    //-----------------------------------------------------------
    // BeachInBedWithXIII.uc
    // Created by iKi
    // Last Modification by iKi
    //-----------------------------------------------------------

Variables
`XIIIPlayerController` | `PC`
`Cine2` | `Pam`
`Pos01,` | `Pos02`
`float` | `TimeStamp`
`bool` | `bActive`
`bEnd,` | `bAlreadyChanged`
`clBlack,` | `clGrey`
`Vector` | `vFinalPosition`

States
GetUpStandUp, LookAtBimbo, Waiting, Init

State GetUpStandUp Function Summary

State LookAtBimbo Function Summary

State Waiting Function Summary

State Init Function Summary

Source Code

    00001	//-----------------------------------------------------------
    00002	// BeachInBedWithXIII.uc
    00003	// Created by iKi
    00004	// Last Modification by iKi
    00005	//-----------------------------------------------------------
    00006	class BeachInBedWithXIII extends Triggers;
    00007
    00008	#exec Texture Import File=Textures\Rock_ico.pcx Name=Rock_ico Mips=Off
    00009
    00010	VAR() Actor Pos01, Pos02;
    00011	VAR() bool bActive;
    00012	VAR Color clBlack, clGrey;
    00013	VAR bool bGo, bEnd, bAlreadyChanged;
    00014	VAR float TimeStamp;
    00015	VAR TRANSIENT XIIIPlayerController PC;
    00016	VAR TRANSIENT Cine2 Pam;
    00017	VAR TRANSIENT Vector vFinalPosition;
    00018
    00019	AUTO STATE Init
    00020	{
    00021		EVENT BeginState()
    00022		{
    00023			if ( !bActive || (XIIIGameInfo(Level.Game).CheckPointNumber>1) )
    00024				Destroy();
    00025			else
    00026				SetTimer( 0.1, true );
    00027		}
    00028
    00029		EVENT Timer()
    00030		{
    00031			if ( XIIIGameInfo( Level.Game ).MapInfo!=none && XIIIGameInfo( Level.Game ).MapInfo.XIIIController!=none)
    00032			{
    00033				PC=XIIIGameInfo(Level.Game).MapInfo.XIIIController;
    00034				SetTimer( 0, false );
    00035				PC.GotoState( 'NoControl' );
    00036				PC.Pawn.Weapon.bOwnerNoSee=true;
    00037				GotoState( 'Waiting' );
    00038			}
    00039		}
    00040	}
    00041
    00042	STATE Waiting
    00043	{
    00044		EVENT BeginState( )
    00045		{
    00046			PC.FilterColor=clBlack;
    00047			PC.FilterColorWanted=clBlack;
    00048			Level.SetInjuredEffect( true, 0.1);
    00049			SetTimer( 1.0, false );
    00050			PC.Pawn.bCollideWorld=false;
    00051			PC.Pawn.SetPhysics( PHYS_None );
    00052		}
    00053
    00054		EVENT Timer( )
    00055		{
    00056			bGo=true;
    00057			TimeStamp=0;
    00058			GotoState( , 'Blink' );
    00059		}
    00060
    00061		EVENT Tick( float dt )
    00062		{
    00063			LOCAL Rotator r;
    00064			LOCAL float f;
    00065
    00066			if (bGo)
    00067			{
    00068				TimeStamp+=dt;
    00069				if ( PC.IsInState( 'NoControl' ) )
    00070					PC.Pawn.SetLocation( Location-(PC.Pawn.EyeHeight)*vect(0,0,1) );
    00071
    00072				f = FMin( 1.0, TimeStamp/4 );
    00073				if (f!=1.0)
    00074				{
    00075					if ( !PC.IsInState( 'NoControl' ) )
    00076					{
    00077						PC.GotoState( 'NoControl' );
    00078						PC.Pawn.bCollideWorld=false;
    00079					}
    00080					r=Pos01.Rotation*(1-f)+f*Pos02.Rotation;
    00081
    00082					PC.SetRotation(r);
    00083				}
    00084				else
    00085				{
    00086					PC.SetRotation(Pos02.Rotation);
    00087					GotoState( 'LookAtBimbo' );
    00088				}
    00089				if ( PC.IsInState( 'NoControl' ) )
    00090					PC.Pawn.SetLocation( Location-(PC.Pawn.EyeHeight /*+ PC.Pawn.CollisionHeight*/)*vect(0,0,1) );
    00091			}
    00092		}
    00093	Blink:
    00094		Level.SetInjuredEffect( false, 12);
    00095		PC.FilterColorSpeed=5;
    00096		PC.FilterColorWanted=clGrey;
    00097		Sleep(0.2+0.2);
    00098		PC.FilterColorSpeed=5;
    00099		PC.FilterColorWanted=clBlack;
    00100		Sleep(0.2+0.2);
    00101		PC.FilterColorSpeed=5;
    00102		PC.FilterColorWanted=clGrey;
    00103		Sleep(0.2+0.5);
    00104		PC.FilterColorSpeed=5;
    00105		PC.FilterColorWanted=clBlack;
    00106		Sleep(0.2+0.2);
    00107		PC.FilterColorSpeed=5;
    00108		PC.FilterColorWanted=clGrey;
    00109		bEnd=true;
    00110	}
    00111
    00112	STATE LookAtBimbo
    00113	{
    00114		EVENT BeginState( )
    00115		{
    00116			LOCAL Cine2 c;
    00117
    00118			foreach DynamicActors(class'Cine2',c)
    00119			{
    00120				if (c.PawnName=="Pam")
    00121				{
    00122					Pam=c;
    00123					break;
    00124				}
    00125			}
    00126			Tag='mitraillage2';
    00127			TimeStamp=0;
    00128		}
    00129
    00130		EVENT Timer( )
    00131		{
    00132			Spawn( class'aahhEmitter',,,Pam.GetBoneCoords('X LIPS').Origin + VECTOR(Pam.Rotation)*40);
    00133		}
    00134
    00135		EVENT Trigger(actor a,pawn p)
    00136		{
    00137			Spawn( class'aahhEmitter',,,Pam.GetBoneCoords('X LIPS').Origin + VECTOR(Pam.Rotation)*40);
    00138			SetTimer( 0.75, false );
    00139			if (Tag!='fin_mitraillage')
    00140				Tag='fin_mitraillage';
    00141			else
    00142				GotoState( 'GetUpStandUp' );
    00143		}
    00144
    00145		EVENT Tick( float dt )
    00146		{
    00147			LOCAL VECTOR v;
    00148			LOCAL Rotator r;
    00149			LOCAL float f;
    00150
    00151			v = Pam.GetBoneCoords('X NECK').Origin;
    00152			if ( Pam.bIsDead )
    00153			{
    00154				TimeStamp+=dt;
    00155				if ( TimeStamp>2 && TimeStamp<5.5 )
    00156					v += vect( 0,0, 40 )+VECTOR( Pam.Rotation )*300;
    00157			}
    00158
    00159			r = rotator(v-Location);
    00160			r-= Pos02.Rotation;
    00161			r.yaw=Clamp(((r.yaw+32768)&65535)-32768,-6144,6144);
    00162			r+= Pos02.Rotation;
    00163
    00164			r = PC.Rotation*0.98+0.02*r;
    00165			if ( PC.IsInState( 'NoControl' ) )
    00166				PC.SetRotation(r);
    00167	//		LOG ( PC.Pawn.Physics );
    00168	//		PC.Pawn.SetPhysics( PHYS_None );
    00169
    00170			/*		if( Pam.bIsDead )
    00171			{
    00172				GotoState( 'GetUpStandUp' );
    00173			}*/
    00174		}
    00175	}
    00176
    00177	STATE GetUpStandUp
    00178	{
    00179		EVENT BeginState( )
    00180		{
    00181			LOCAL vector v;
    00182			LOCAL Rotator r;
    00183			v = VECTOR(PC.Rotation);//Pam.Location-PC.Pawn.Location;
    00184			v.Z = 0;
    00185			v = NORMAL(v);
    00186
    00187			vFinalPosition = PC.Pawn.Location+100*v+80*VECT(0,0,1);
    00188			TimeStamp=0;
    00189		}
    00190
    00191		EVENT Tick( float dt )
    00192		{
    00193			LOCAL Rotator r;
    00194			LOCAL float f;
    00195
    00196	//		r.Yaw = PC.rotation.Yaw;
    00197			r.Yaw = ROTATOR( Pam.Location+VECTOR(Pam.Rotation)*120- PC.Pawn.Location).Yaw;
    00198			r.Roll = 0;
    00199			TimeStamp+=dt;
    00200
    00201			r = PC.Rotation*0.98+0.02*r;
    00202			if (TimeStamp<5)
    00203				r.Pitch = -8192*sin(0.628*TimeStamp);
    00204			else
    00205				r.Pitch = 0;
    00206
    00207			f = 0.98**(dt*100);
    00208			r.Pitch = PC.Rotation.Pitch *f+(1-f)*r.Pitch;
    00209			PC.SetRotation(r);
    00210
    00211			if ( PC.IsInState( 'NoControl' ) )
    00212			{
    00213				PC.Pawn.SetLocation( PC.Pawn.Location*f+(1-f)*vFinalPosition );
    00214				if ( vSize(vFinalPosition-PC.Pawn.Location)<10 && TimeStamp>=5 )
    00215				{
    00216					PC.Pawn.bCollideWorld=true;
    00217					PC.Pawn.SetPhysics( PHYS_Walking );
    00218					PC.GotoState('PlayerWalking');
    00219					PC.Pawn.Weapon.bOwnerNoSee=false;
    00220
    00221					Destroy();
    00222					return;
    00223				}
    00224			}
    00225		}
    00226	}
    00227
    00228
    00229
    00230	defaultproperties
    00231	{
    00232	     bActive=True
    00233	     clGrey=(B=128,G=128,R=128)
    00234	     InitialState="Init"
    00235	     Texture=Texture'XIDCine.Rock_ico'
    00236
bDirectional=True 00237 }

End Source Code