当前位置: 首页>>代码示例>>C#>>正文


C# Weapon.GetType方法代码示例

本文整理汇总了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;
 }
开发者ID:IAmEska,项目名称:PlanetShooter,代码行数:7,代码来源:WeaponFactory.cs

示例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 );
        }
开发者ID:BGCX261,项目名称:zombeeswarm-svn-to-git,代码行数:12,代码来源:EntityPlayer.cs

示例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;
    }
开发者ID:tedmunds,项目名称:HavokGear,代码行数:54,代码来源:PlayerController.cs


注:本文中的Weapon.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。