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


C# Gun类代码示例

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

示例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;
	}
开发者ID:amacdiarmid,项目名称:IP3-Project-RSSK,代码行数:35,代码来源:PlayerHUD.cs

示例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();
        }
开发者ID:Zerophase,项目名称:DyMProject,代码行数:25,代码来源:MovablePhysicsMediator.cs

示例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;
	}
开发者ID:ardaWill,项目名称:Create-a-Game-Source,代码行数:7,代码来源:GunController.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     machineGun = GetComponent<MachineGun>();
     rocketLauncher = GetComponent<RocketLauncher>();
     gun = GetComponent<Gun>();
     shotgun = GetComponent<Shotgun>();
 }
开发者ID:j4ra,项目名称:FPS,代码行数:8,代码来源:Playar_Attack.cs

示例6: revertState

	void revertState( Gun gun ) 
	{ 
		gun.capacity = gun.loadedAmmo.magSize;
		gun.isReloading = false; 
		
		gun.reloadFinished();
	}
开发者ID:Avatarchik,项目名称:Duel-Off,代码行数:7,代码来源:ReloadBarTween.cs

示例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);
 }
开发者ID:rodneyxr,项目名称:Zombie-Survival,代码行数:7,代码来源:WeaponManager.cs

示例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.");
      }
    }
开发者ID:oskar,项目名称:pistol,代码行数:30,代码来源:Player.cs

示例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;
			}
		}
	}
开发者ID:Avatarchik,项目名称:Duel-Off,代码行数:34,代码来源:HealhPackSprite.cs

示例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; //????????????
	}
开发者ID:daivers,项目名称:unity3d,代码行数:7,代码来源:GunController.cs

示例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()));
 }
开发者ID:bodedoctor,项目名称:topresearch,代码行数:7,代码来源:GunEditor.cs

示例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);
        }
    }
开发者ID:minh3d,项目名称:Fish,代码行数:28,代码来源:Module_BulletSplit.cs

示例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>() ;
    }
开发者ID:Rogueski,项目名称:soakertournament,代码行数:13,代码来源:Player.cs

示例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();
    }
开发者ID:Zerophase,项目名称:DyMProject,代码行数:29,代码来源:HoverSlug.cs

示例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
				)
			);
		}*/
	}
开发者ID:Avatarchik,项目名称:Duel-Off,代码行数:29,代码来源:PauseSprite.cs


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