武器系统Weapon systemWord格式.docx
《武器系统Weapon systemWord格式.docx》由会员分享,可在线阅读,更多相关《武器系统Weapon systemWord格式.docx(13页珍藏版)》请在冰点文库上搜索。
9.Addtheattributestatic="
1"
intheItemobject;
Lettheweaponsinthegamescenenotmoveandincreasetherotate="
attributetorotatetheweaponinthegamescene
Runthetesttoseeiftheaboveattributesareineffect
10.AddcollisiondetectionmemberfunctiononCollision(%this,%obj,%col)fortheweaponobjectdatasetobject,andcalltheplayer'
sweaponfunctioninthefunctiontolettheweaponappearintheplayer'
TheonCollisionfunctionparameterindicatesthat%thisistheobjectoftheweaponitem%objastheobjectoftheweaponitem%colistheobjectthatobjectstotheobjectistheplayer
Thetestplayerwillbeabletopickuptheweapon
3.Thestatuschangeoftheweaponisrealizedbyaddingmembersoftheweapondatasetobject
11.TheeyeOffsetattributeisaddedtotheweapondatasetobject,sothatthepositionoftheweaponinthefirstpersonstatewillnotbemoved
EyeOffset="
0.10.4-0.6"
;
Runthetesttoseeiftheweapon'
spositionrelativetotheeyechangesinthefirstperson
12.Thedefinitionattributeoftheweaponstateisaddedtotheweapondatasetobjectsothattheweaponcanbeswitchedbetweenseveralstates
//preactivationstatus
StateName[0]="
Preactivate"
StateTransitionOnLoaded[0]="
Activate"
.
//thestateofthetransitioncondition//transformation
StateTransitionOnNoAmmo[0]="
NoAmmo"
//activation
StateName[1]="
StateTransitionOnTimeout[1]="
Ready"
StateTimeoutValue[1]=0.6;
StateSequence[1]="
//standby
StateName[2]="
StateTransitionOnNoAmmo[2]="
StateTransitionOnTriggerDown[2]="
Fire"
//fire
StateName[3]="
StateTransitionOnTimeout[3]="
Reload"
StateTimeoutValue[3]=0.1;
StateFire[3]=true;
StateRecoil[3]=LightRecoil;
StateAllowImageChange[3]=false;
StateSequence[3]="
StateScript[3]="
onFire"
//ammunition
StateName[4]="
StateTransitionOnNoAmmo[4]="
StateTransitionOnTimeout[4]="
StateTimeoutValue[4]=0.5;
StateAllowImageChange[4]=false;
StateSequence[4]="
StateEjectShell[4]=true;
//noammunition
StateName[5]="
StateTransitionOnAmmo[5]="
StateSequence[5]="
StateTransitionOnTriggerDown[5]="
DryFire"
//dryfire
StateName[6]="
StateTimeoutValue[6]=1.0;
StateTransitionOnTimeout[6]="
Runthetesttoseeiftheweaponhasastatuschangeeffect
13.Jointhememberfunctionoftheweapondatasetobject(%this,%obj,%slot),callthefunctionsetImageAmmo,whichsetstheweaponcartridgeinthefunction,andequipitwithammunitionwhilepickinguptheweapon
TheonMountfunctionparameterindicatesthat%thisistheweapondatasetobject%objastheobjectoftheweapon'
sobject%slotfortheweapon'
sbulletobject
Whethertheweaponissettousetheammunitionfunction:
playerobject.SetImageAmmo(bulletsobject,whethertherearebullets(trueorfalse));
Runthetesttoseeiftheweaponhasammunition
Iv.Bulletsthataddweaponstoachieveweapon'
sfiringfunction
14.ThebulletProjectileDatasetobjectthatdefinestheweaponisCrossbowProjectile,andtheprojectileShapeNamepropertyofthisobjectisassociatedwiththebulletmodelfile
15.AddshotforweaponsdatasetonFire(%this,obj,%%slot)memberfunctions,createabulletobjectProjectileinfunction,forthebulletobjectadddatablockpropertiesforCrossbowProjectile,addinitialVelocityattributevalueforthe"
001"
addinitialPositionattributevalueis%obj.ThegetMuzzlePointslot(%),addsourceObjectvalueis%obj
TheononFirefunctionparameterindicatesthat%thisistheweapondatasetobject%objistheobjectthatisequippedwithweaponandtheplayer%slotisthebulletobjectforthatweapon
Propertydescription:
TheinitialdirectionandvectoroftheinitialVelocity//bullet
InitialPosition//initialpositionofthebullet
SourceObject//anobjectthatfiresabullet(action:
thebulletwillnotcollidewithitsobject)
Runthetesttoseeiftheweaponisfiredafterfiring
16.FromTorqueinstallerSDK/example/starter.TheFPS/client/UIdirectoryiscopiedtothecrossHair.PNGsightpicturetohergameproject/client/UIdirectory,andopenthedirectoryplayGui.GUIfilefoundinthefiletocreateGuiCrossHairHudtypegameobjectcodeiscopiedtotheproject/client/UI/playGuiGUIfile
Runthetesttoseeifthereisasightinthegame
17.Usethefollowingmemberfunctionstocompletethecalculationofthedirectionofthebullet:
Memberfunctiondescription:
Playerobject.GetMuzzlePoint(%slot)//getthelocationofthemuzzle
Playerobjects.
GetMuzzleVector(%slot)//thedirectionofthemuzzle
Playerobject.GetVelocity();
//avectorthatmovesthedirectionandspeedoftheplayer
Vectorcalculationfunction:
V3isequaltoVectorAdd(v1,v2)//youcanaddvectorsv1andv2togetthev3vector
V3isequaltoVectorScale(v1,10)//I'
mgoingtozoomin10timesthevectorv1togetthev3vector
Formula1:
theinitialdirectionofthebullet=thevectorofthedirectionofthegun
Runthetesttoseeifthedirectionofthebulletinthegameisalignedwiththedirectionofthegun
Formula2:
theinitialdirectionofthebullet=300timesthevectorofthedirectionofthegun
Runthetesttoseeifthebulletisgettingfasterinthegame
Formula3:
theinitialdirectionofthebulletisequalto300timesthevectorofthedirectionofthegun,plusthevectorofthemovementofthecharacter
Runthetesttoseeifthedirectionofthebulletinthemovementisinlinewiththesight
18.AdjustthepropertiesofProjectileDataforthebulletdatasetandachievetheeffectofthegrenadestillout
Lifetime=5000;
//determinehowlongitwilltaketobedeletedfromthegameworld
FadeDelay=5000;
//howlongafterthegenerationhasbecometransparent(iehidden)
BounceElasticity=0;
//bounceheightaftercollision
BounceFriction=0;
//thelostmomentumofthebounce
IsBallistic=true;
//confirmthatthegravitationalpullofgravityisnotvalidforthegravityoftheearth.
GravityMod=0.001;
//gravity
6.Usetheattachedparticlestorealizetheparticleeffectofweaponbullets
19.Thedataset(particleledata)objectthatcreatestheparticlebeforedefiningtheweaponscriptisCrossbowBoltParticle
20.ThetextureNameattributeisspecifiedintheCrossbowBoltParticledatasetasthepathofsmoke.PNG
21.Createtheparticleemitterdataset(ParticleEmitterData)objectCrossbowBoltEmitter
22.SpecifytheparticleattributeasCrossbowBoltParticleintheCrossbowBoltEmitterdataset
23.SpecifytheparticleEmitterattributeinthebulletdatasetobjectCrossbowProjectileasCrossbowBoltEmitter
Runthetesttoseethebulleteffect
24.AddthefollowingattributestotheCrossbowBoltParticleobjecttoseetheeffect
DragCoefficient=0.0;
GravityCoefficient=0.35;
//gravityisnegativetomakeitupward.
InheritedVelFactor=0.00;
//inertiaobtainedfromotherobjects.
LifetimeMS=580;
//thedisplaytimeoftheparticleislong.
LifetimeVarianceMS=150;
UseInvAlpha=false;
SpinRandomMin=15.0;
SpinRandomMax=15.0;
Colors[0]="
0.80.60.00.1"
//setthecolorofasequenceparticle
Colors[1]="
0.80.650.00.1"
Colors[2]="
0.00.00.00.0"
Sizes[0]=1.0;
//setthezoomsizeofasequenceparticle.
Sizes[1]=2.0;
Sizes[2]=4.0;
Times[0]=0.1;
//setthetimeperiodoftheparticlesequence.
Times[1]=0.4;
Times[2]=1.0;
25.AddthefollowingpropertiestotheCrossbowBoltEmitterobjecttoseetheeffect
EjectionPeriodMS=15;
//howmanymillisecondstoemitaparticle.
PeriodVarianceMS=5;
EjectionVelocity=0.35;
//thevelocityoftheparticlemoving.
VelocityVariance=0.20;
ThetaMin=0.0;
MinimumemissionAngleof//particleemitter(xaxis)
ThetaMax=60.0;
MaximumemissionAngleof//particleemitter(xaxis)
Runthetesttoseethemodifiedbulletparticleeffect
7:
realizetheeffectofbulletexplosionparticle
26.
Repeatthe19-22stepsinpart6tocreate:
CrossbowExplosionParticleparticledatasets(ParticleData