本文整理汇总了C#中Gun类的典型用法代码示例。如果您正苦于以下问题:C# Gun类的具体用法?C# Gun怎么用?C# Gun使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Gun类属于命名空间,在下文中一共展示了Gun类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start () {
player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerMovement> ();
gun = player.GetComponentInChildren<Gun> ();
missiles = player.GetComponentInChildren<MissileLauncher> ();
participants = GameObject.FindGameObjectWithTag ("Participants").GetComponent<ParticipantManager> ();
targetHold = targetLookDelay;
}
示例2: Spawn
public void Spawn(GameObject player)
{
if (HUDComps)
Destroy(HUDComps.gameObject);
playerStats = player.GetComponent<PlayerStats>();
playerCont = player.GetComponent<PlayerController>();
if (playerCont.team == PlayerTeam.TeamYellow)
HUDComps = Instantiate(yellowHud).GetComponent<HUDcomps>();
else
HUDComps = Instantiate(blueHud).GetComponent<HUDcomps>();
maxHP = playerStats.maxHealth;
if (player.GetComponent<Gun>())
{
hasGun = true;
playerGun = player.GetComponent<Gun>();
}
else
{
hasGun = false;
HUDComps.AmmoImage.enabled = false;
HUDComps.AmmoText.enabled = false;
}
startCrosshairSize = HUDComps.CrosshairImg.rectTransform.sizeDelta;
startDamageColour = HUDComps.DamageImg.color;
damageColour = startDamageColour;
damageTime = 0;
StartCrosshailColour = HUDComps.CrosshairImg.color;
}
示例3: Start
protected override void Start()
{
// TODO remove player checks from this class once a better solution than flipping the elbo is found
if (this is Player)
{
playerWrist = GameObject.FindGameObjectWithTag("GunRotator");
gunFlip = playerWrist.GetComponent<Gun>();
}
var boxCollider = gameObject.GetComponent<BoxCollider>();
rotationBox = new AABB3D(Vector3.zero,
boxCollider.size.x * transform.lossyScale.x,
boxCollider.size.y * transform.lossyScale.y,
boxCollider.size.z * transform.lossyScale.z);
if (transform.GetChild(preventDeformation).name == "PreventDeformedObject")
{
findModelWithDeformationProtection();
}
else
{
findModelWithoutDeformationProtection();
}
base.Start();
}
示例4: EquipGun
public void EquipGun(Gun gunToEquip) {
if (equippedGun != null) {
Destroy(equippedGun.gameObject);
}
equippedGun = Instantiate (gunToEquip, weaponHold.position,weaponHold.rotation) as Gun;
equippedGun.transform.parent = weaponHold;
}
示例5: Start
// Use this for initialization
void Start()
{
machineGun = GetComponent<MachineGun>();
rocketLauncher = GetComponent<RocketLauncher>();
gun = GetComponent<Gun>();
shotgun = GetComponent<Shotgun>();
}
示例6: revertState
void revertState( Gun gun )
{
gun.capacity = gun.loadedAmmo.magSize;
gun.isReloading = false;
gun.reloadFinished();
}
示例7: DropWeapon
public void DropWeapon(Gun weaponToDrop)
{
Vector3 dropPosition = transform.position;
dropPosition.y = 0f;
ItemDisplay itemDisplay = (Instantiate(Resources.Load("Prefabs/ItemDisplay"), dropPosition, Quaternion.identity) as GameObject).GetComponent<ItemDisplay>();
itemDisplay.Init(weaponToDrop.gameObject, 30f, true);
}
示例8: ApplyDamage
public void ApplyDamage(Gun gun, int damage)
{
if (damage < 1 || damage >= MaxDamage)
{
throw new ArgumentOutOfRangeException("damage", "Damage must be 1-4.");
}
if (gun == Gun.Left)
{
if (IsLeftGunDead)
{
throw new InvalidOperationException("Cannot shoot left gun, it is already dead.");
}
LeftGun += damage;
}
else if (gun == Gun.Right)
{
if (IsRightGunDead)
{
throw new InvalidOperationException("Cannot shoot right gun, it is already dead.");
}
RightGun += damage;
}
else
{
throw new InvalidOperationException("Can only be called with gun set to Left or Right.");
}
}
示例9: onUIUpdate
void onUIUpdate( Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats )
{
if( clicked == gameObject && state != PlayerController._GameState.None )
{
if( Application.platform == RuntimePlatform.IPhonePlayer )
ChartBoostBinding.trackEvent( "Health Pack Use" );
switch( name )
{
case "HPackTiny":
DBAccess.instance.userPrefs.useHealthPack(0);
tweenScale();
break;
case "HPackSmall":
DBAccess.instance.userPrefs.useHealthPack(1);
tweenScale();
break;
case "HPackMedium":
DBAccess.instance.userPrefs.useHealthPack(2);
tweenScale();
break;
case "HPackLarge":
DBAccess.instance.userPrefs.useHealthPack(3);
tweenScale();
break;
case "HPackHuge":
DBAccess.instance.userPrefs.useHealthPack(4);
tweenScale();
break;
default:
break;
}
}
}
示例10: EquipGun
public void EquipGun(Gun gunToEquip) {
if (equippedGun != null) { //????????????
Destroy(equippedGun.gameObject);
}
equippedGun = Instantiate (gunToEquip, weaponHold.position, weaponHold.rotation) as Gun; // создаем оружие используя точку появления
equippedGun.transform.parent = weaponHold; //????????????
}
示例11: OnInspectorGUI
public override void OnInspectorGUI()
{
targetGun = (Gun)target;
base.OnInspectorGUI();
EditorGUILayout.LabelField("Damage Per Shot", string.Format("{0:f2}", targetGun.GetDamagePerShot()));
EditorGUILayout.LabelField("Damage Per Second", string.Format("{0:f2}", targetGun.GetDamagePerSecond()));
}
示例12: Handle_GunFire
void Handle_GunFire(Player p, Gun g, int score)
{
//Debug.Log("Handle_GunFire");
Bullet prefabBullet = ModuleBullet.Get_PrefabBullet_Used(g);
//tk2dAnimatedSprite ani;
if (prefabBullet == null)
return;
GunLevelType gLvType = g.GetLevelType();
GunPowerType gPowerType = g.GetPowerType();
int NumInstance = 2 + (int)gLvType;//���ɵ�����
float widthBullet = WidthBulletNormal[(int)g.GetLevelType()];
Vector3 posOffset = new Vector3(-widthBullet * NumInstance / 2F, 0F);
for (int i = 0; i != NumInstance; ++i)
{
Bullet b = Pool_GameObj.GetObj(prefabBullet.gameObject).GetComponent<Bullet>();
b.Prefab_GoAnisprBullet = Prefab_AniBullet;
b.Prefab_SpriteNameSet = gPowerType == GunPowerType.Normal ? nameSetAniBulletNor : nameSetAniBulletLizi;
BulletEx_Splitor bEx_Splitor = b.gameObject.AddComponent<BulletEx_Splitor>();
bEx_Splitor.FactorSplit = NumInstance;
b.transform.position = g.local_GunFire.position + g.AniSpr_GunPot.transform.rotation * posOffset;
posOffset.x += widthBullet;
b.Score = score;
b.Fire(p, null, g.AniSpr_GunPot.transform.rotation);
}
}
示例13: Start
// Currently will just create a Penny
// public Player()
// {
//
//
// }
public void Start()
{
pGun = (GameObject)Instantiate((GameObject)(Resources.Load("Prefabs/Guns/TestGun"))) ;
pGun.transform.parent = gameObject.transform ;
gun = pGun.GetComponent<Gun>() ;
}
示例14: Start
protected override void Start()
{
for (int i = 0; i < transform.childCount; i++)
{
if (transform.GetChild(i).name == "hoverslug01Mesh")
{
var temp = transform.GetChild(i);
for (int j = 0; j < temp.childCount; j++)
{
if(temp.GetChild(j).tag == "EquippedGun")
{
gunModel = temp.GetChild(j).gameObject;
break;
}
}
}
}
var test = rangeWeaponFactory.Create(WeaponTypes.SLUG_GUN);
test.Character = Character;
messageDispatcher.DispatchMessage(new Telegram(test, null, true));
Character.CharacterType = CharacterTypes.ENEMY;
Character.AddWeapon((RangeWeaponBase)slugGun);
Character.Equip(slugGun);
gun = gameObject.GetComponentInChildren<Gun>();
base.Start();
}
示例15: onUIUpdate
void onUIUpdate( Gun gun, PlayerController._GameState state, GameObject clicked, EnemyStats stats )
{
if( clicked == gameObject )
{
if( onPause != null )
onPause();
}
/*if( state == PlayerController._GameState.Reload )
{
iTween.MoveTo( PARENT, iTween.Hash(
"y", TWEEN_POS,
"islocal", true,
"time", 0.4f,
"easetype", iTween.EaseType.easeOutBack
)
);
}
if( state == PlayerController._GameState.Active || state == PlayerController._GameState.IsReloading )
{
iTween.MoveTo( PARENT, iTween.Hash(
"y", RESET_POS,
"islocal", true,
"time", 0.4f,
"easetype", iTween.EaseType.easeInBack
)
);
}*/
}