本文整理汇总了C#中Weapon.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.GetType方法的具体用法?C# Weapon.GetType怎么用?C# Weapon.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public Weapon Get(Weapon prefab)
{
Weapon p = CachePool<Weapon>.Instance.GetObjectOfType (prefab.GetType ().Name);
if (p == null)
p = Instantiate<Weapon> (prefab);
return p;
}
示例2: AddWeapon
public void AddWeapon( Weapon weapon )
{
foreach( Weapon w in _weapons )
if( w.GetType() == weapon.GetType() )
{
_weapon = w;
return;
}
_weapon = weapon;
_weapons.Add( weapon );
}
示例3: NewWeaponAttached
public override void NewWeaponAttached(Weapon attached)
{
base.NewWeaponAttached(attached);
attached.ResetRefireDelay();
// Cache ref to photon whip when it is attached (on spawn usually)
if(attached != null && attached.GetType() == typeof(Whip_PhotonWhip)) {
whipAttachment = (Whip_PhotonWhip)attached;
Debug.Log("Player has photon whip attachment");
}
// check if the weapon wants a laser sight or not
if(attached != null && attached.GetType() != typeof(Whip_PhotonWhip)) {
if(attached.hasLaserSight && laserSightRenderer != null) {
laserSightRenderer.enabled = true;
}
else if(laserSightRenderer != null) {
laserSightRenderer.enabled = false;
}
}
// update the hud images
if(playerHUD != null && playerHUD.equippedWeaponElement != null) {
Sprite weaponSprite = attached.GetWeaponSprite(); ;
playerHUD.equippedWeaponElement.sprite = weaponSprite;
playerHUD.equippedWeaponElement.enabled = weaponSprite != null? true : false;
}
if(playerHUD != null && playerHUD.damageTypeElement != null) {
playerHUD.SetDamageTypeDisplay(attached.damageTypeList);
}
// if there was a detached eapon, to attach this one, then swap it into the seconrady slot if there is nothing there
if(backupWeapon == null && detachedWeapon != null) {
// need to bring the detatched weapon back fromn the dead
detachedWeapon.transform.SetParent(mechComponent.leftAttachPoint);
detachedWeapon.gameObject.SetActive(true);
detachedWeapon.GetRenderer().enabled = false;
// cahche the weapon
backupWeapon = detachedWeapon;
// and update hud
playerHUD.secondarydWeaponElement.enabled = true;
playerHUD.secondarydWeaponElement.sprite = backupWeapon.GetWeaponSprite();
}
// Send a message to the HUD to display on screen
if(playerHUD != null) {
playerHUD.DoOnScreenAnnouncement(attached.weaponName);
}
detachedWeapon = null;
}