本文整理汇总了C#中Weapon.SetClipRemaining方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.SetClipRemaining方法的具体用法?C# Weapon.SetClipRemaining怎么用?C# Weapon.SetClipRemaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.SetClipRemaining方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
//private const float WalkVelAnimCoeff = 2.5f;
//private Transform torso;
private void Awake()
{
agent = GetComponent<NavMeshAgent>();
enemyAnimator = GetComponent<Animator>();
InitKillable(new Vector3(0, 1, 0));
primaryWeaponGameObject = (GameObject)Instantiate(PrimaryWeapon, Vector3.zero, Quaternion.identity);
//primaryWeaponGameObject.transform.parent = transform.FindChild("NewDude").FindChild("Pelvis").FindChild("Chest").FindChild("UpperArmRight").FindChild("LowerArmRight");
primaryWeaponGameObject.transform.parent = transform.FindChild("swat").FindChild("RightHand");//.FindChild("Hips").FindChild("Spine").FindChild("Spine1").FindChild("Spine2").FindChild("RightShoulder").FindChild("RightArm").FindChild("RightForeArm").FindChild("RightHand");
primaryWeaponGameObject.transform.localPosition = Vector3.zero;
primaryWeapon = primaryWeaponGameObject.GetComponent<Weapon>();
primaryWeapon.InitWeapon();
primaryWeapon.SetClipRemaining(primaryWeapon.ClipCapacity);
primaryWeapon.OnShoot += OnShootPrimaryWeapon;
primaryWeaponShootPoint = primaryWeapon.ShootPoint;
muzzleFlash = primaryWeapon.MuzzleFlash;
//torso = transform.FindChild("NewDude").FindChild("Pelvis").FindChild("Chest");
FindTarget();
}
示例2: Give
public void Give(GameObject collectible)
{
var isExistingWeapon = false;
if (primaryWeapon != null)
{
var collectedWeapon = collectible.GetComponent<Weapon>();
if (collectedWeapon != null)
isExistingWeapon = primaryWeapon.Name == collectedWeapon.Name;
}
if (!isExistingWeapon)
{
Destroy(primaryWeaponGameObject);
primaryWeaponGameObject = (GameObject)Instantiate(collectible, Vector3.zero, Quaternion.identity);
//primaryWeaponGameObject.transform.parent = transform.FindChild("NewDude").FindChild("Pelvis").FindChild("Chest").FindChild("UpperArmRight").FindChild("LowerArmRight");
primaryWeaponGameObject.transform.parent = transform.FindChild("soldier").FindChild("Hips").FindChild("Spine").FindChild("Spine1").FindChild("Spine2").FindChild("RightShoulder").FindChild("RightArm").FindChild("RightForeArm").FindChild("RightHand");
primaryWeaponGameObject.transform.localPosition = Vector3.zero;
primaryWeaponGameObject.transform.localRotation = Quaternion.Euler(0, 0, 0);
primaryWeapon = primaryWeaponGameObject.GetComponent<Weapon>();
primaryWeapon.InitWeapon();
primaryWeapon.SetClipRemaining(primaryWeapon.ClipCapacity);
primaryWeapon.OnShoot += OnShootPrimaryWeapon;
primaryWeapon.SetClipRemaining(0);
}
if (primaryWeapon != null)
PrimaryWeaponAmmo += primaryWeapon.ClipCapacity;
}