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


C# Weapon类代码示例

本文整理汇总了C#中Weapon的典型用法代码示例。如果您正苦于以下问题:C# Weapon类的具体用法?C# Weapon怎么用?C# Weapon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Weapon类属于命名空间,在下文中一共展示了Weapon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteAddSupplementCommand

        protected override void ExecuteAddSupplementCommand(string[] commandWords)
        {
            string supplementId = commandWords[1];
            string id = commandWords[2];

            var unitForAdding = this.GetUnit(id);
            ISupplement supplement = null;
            switch (supplementId)
            {
                case "AggressionCatalyst":
                    supplement =  new AggressionCatalyst();
                    break;
                case "Weapon":
                   supplement =  new Weapon();
                    break;
                case "PowerCatalyst":
                    supplement = new PowerCatalyst();
                    break;
                case "HealthCatalyst":
                    supplement = new HealthCatalyst();
                    break;
                default:
                    break;
            }

            unitForAdding.AddSupplement(supplement);
        }
开发者ID:IskraNikolova,项目名称:Object-oriented-programming,代码行数:27,代码来源:ExtendingHoldingPen.cs

示例2: NewWeaponEquipped

	void NewWeaponEquipped(Weapon.WeaponType weaponType)
	{
		//reset weapon animations
		animator.Rebind();

		//activate/deactivate specific animator layers when new weapons get equipped
		if (weaponType == Weapon.WeaponType.Sword)
		{
			animator.SetLayerWeight(2, 1);
			animator.SetLayerWeight(3, 0);
			animator.SetLayerWeight(4, 0);
		}
		else if (weaponType == Weapon.WeaponType.Axe)
		{
			animator.SetLayerWeight(2, 0);
			animator.SetLayerWeight(3, 1);
			animator.SetLayerWeight(4, 0);
		}
		else if (weaponType == Weapon.WeaponType.Hammer)
		{
			animator.SetLayerWeight(2, 0);
			animator.SetLayerWeight(3, 0);
			animator.SetLayerWeight(4, 1);
		}
	}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:25,代码来源:AnimationHandler.cs

示例3: genItem

 public static new Weapon genItem()
 {
     Weapon i = new Weapon();
     i.itemID = ItemDatabase.GenerateID();
     i.billboard = false;
     return i;
 }
开发者ID:Gornel,项目名称:Overworld,代码行数:7,代码来源:Weapon.cs

示例4: Awake

 new void Awake()
 {
     base.Awake();
     weapon = GetComponent<Weapon>();
     MAX_HEALTH *= 10f;
     health = MAX_HEALTH;
 }
开发者ID:rainbee2214,项目名称:TMHTU2015,代码行数:7,代码来源:Player.cs

示例5: TakesHit

    public void TakesHit(string weaponType, Weapon weapon, Collider2D coll, int hitFrom)
    {
        // calculate damage
        player.HP -= (int)(weapon.damage * DIFFICULTY_DAMAGE_MODIFIER);

        // produce effects
        // params for ShakeCamera = duration, strength, vibrato, randomness
        Messenger.Broadcast<float, float, int, float>("shake camera", .5f, .3f, 20, 5f);
        Messenger.Broadcast<int>("reduce hp", player.HP);

        // float xDistance = hitFrom == LEFT ? 2f : -2f;
        // transform.DOJump(new Vector3(transform.position.x + xDistance, transform.position.y, transform.position.z), .2f, 1, .5f, false);

        if (hitFrom == RIGHT)
        {
            BroadcastMessage("RepulseToLeft", 5.0F);
        }
        else
        {
            BroadcastMessage("RepulseToRight", 5.0F);
        }

        if (player.HP > 0)
        {
            MFX.FadeToColorAndBack(spriteRenderer, MCLR.bloodRed, 0f, .2f);
        }
        else
        {
            Messenger.Broadcast<string, Collider2D, int>("player dead", "projectile", coll, hitFrom);
        }
    }
开发者ID:hftamayo,项目名称:Unity2D-Components,代码行数:31,代码来源:PlayerManager.cs

示例6: Start

 void Start()
 {
     _collider = GetComponent<Collider2D>();
     _rigidbody = GetComponent<Rigidbody2D>();
     weapon = GetComponentInChildren<Weapon>();
     anim = GetComponent<Animator>();
     SP = GetComponent<SpecialPower>();
     distToGround = _collider.bounds.extents.y;
     UpdateHealthSlider();
     GameManager.instance.players.Add(this);
     GameManager.instance.SetControls();
     if (useSecondaryControls)
     {
         keys[0] = KeyCode.W;
         keys[1] = KeyCode.Space;
         keys[2] = KeyCode.D;
         keys[3] = KeyCode.A;
         keys[4] = KeyCode.LeftShift;
         facingRight = true;
     }
     else
     {
         keys[0] = KeyCode.UpArrow;
         keys[1] = KeyCode.Return;
         keys[2] = KeyCode.RightArrow;
         keys[3] = KeyCode.LeftArrow;
         keys[4] = KeyCode.RightShift;
         transform.localScale = new Vector3(-1, 1, 1);
         facingRight = false;
     }
 }
开发者ID:GlitchBoss,项目名称:TextWars,代码行数:31,代码来源:Player.cs

示例7: SpawnMuzzleFlare

 private void SpawnMuzzleFlare(Weapon weapon)
 {
     var flare = ObjectPool.Instance.GetObject(MuzzleFlare);
     flare.transform.position = weapon.Emitter.position;
     flare.transform.rotation = weapon.Emitter.rotation;
     flare.transform.parent = weapon.Emitter;
 }
开发者ID:steve-salmond,项目名称:LD33,代码行数:7,代码来源:ProjectileAttack.cs

示例8: Morph

    public static Weapon Morph(Weapon mine, Weapon other)
    {
        Weapon combined = new Weapon();

        float targetStrength = Mathf.Max(mine.GetStrength(), other.GetStrength()) + MORPH_STRENGTH_INCREASE;
        float strength = 0;

        foreach (BulletSpawner bs in mine.bulletSpawners) {
            if (UnityEngine.Random.value < CHANCE_TO_KEEP_WEAPON) {
                strength += bs.GetStrength(combined);
                combined.bulletSpawners.Add(bs);
            }
        }

        foreach (BulletSpawner bs in other.bulletSpawners) {
            if (UnityEngine.Random.value < CHANCE_TO_GAIN_WEAPON) {
                strength += bs.GetStrength(combined);
                combined.bulletSpawners.Add(bs);
            }
        }

        while (strength < targetStrength) {
            BulletSpawner bulletSpawner = BulletSpawner.Random();
            strength += bulletSpawner.GetStrength(combined);
            combined.bulletSpawners.Add(bulletSpawner);
        }

        return combined;
    }
开发者ID:wez470,项目名称:GameJam2,代码行数:29,代码来源:Weapon.cs

示例9: Start

 void Start()
 {
     player_controller_ = GetComponent<PlayerController>();
     var weapon_attacher = GetComponent<WeaponAttacher>();
     right_weapon_ = weapon_attacher.getRightWeapon;
     left_weapon_ = weapon_attacher.getLeftWeapon;
 }
开发者ID:ooHIROoo,项目名称:BuildFighters,代码行数:7,代码来源:PlayerAttacker.cs

示例10: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Hello");

            Weapon stick = new Weapon("Stick", 1, WeaponType.Blunt, 2);

            CharacterBase player = Player.GetInstance();

            Console.WriteLine(player);

            player.EquipWeapon(stick);

            Console.WriteLine(player);
            Console.WriteLine("Player MaxHealth : " + player.MaxHealth);
            Console.WriteLine("Adding +10 health buff to player");
            BaseEffect effect = new MaxHealthAdditionEffect(10);
            player.EffectsManager.AddEffect(effect);

            Console.WriteLine("Player MaxHealth : " + player.MaxHealth);

            Console.WriteLine("Removing +10 health buff from player");
            player.EffectsManager.RemoveEffect(effect);

            Console.WriteLine("Player MaxHealth : " + player.MaxHealth);

            Console.WriteLine("Press Enter to Exit");
            Console.ReadKey();
        }
开发者ID:Kornetzke,项目名称:ConceptTests,代码行数:28,代码来源:Program.cs

示例11: AddWeapon

 public void AddWeapon(string key, Weapon weapon)
 {
     if (!GetWeapons().ContainsKey(key))
     {
         _weapons.Add(key, weapon);
     }
 }
开发者ID:djastin,项目名称:XNA2DGame,代码行数:7,代码来源:FeatureLoader.cs

示例12: Start

	// Use this for initialization
	void Start () {

        Inventory = new List<Item>();

        if (GodMode)
        {
            Weapon w = new Weapon(WeaponType.Rifle);
            Inventory.Add(w);
        }

        //set active (for now)
        activeItem = Inventory[0];

        Facing = FacingDirection.Left;
        Animation = AnimateState.Down;
        
        PlayerCamera = Camera.main;
        TargetPosition = transform.position;

        PlayerConvText = GameObject.Find("PlayerConvText");

        textures = new Texture[4];

        textures[0] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_back.png", typeof(Texture));
        textures[1] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_front.png", typeof(Texture));
        textures[2] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_left.png", typeof(Texture));
        textures[3] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_right.png", typeof(Texture));

        GetComponent<Renderer>().material.mainTexture = textures[2];
	}
开发者ID:miintz,项目名称:ParadigmShift,代码行数:31,代码来源:Player.cs

示例13: Start

	void Start()
	{
		projectile		= GetComponent<ProjectileManager>();
		weapon			= GetComponentInChildren<Weapon>();
		target			= GameObject.Find(PLAYER).transform;
		attackInterval = Rand.Range(1.5f, 2.5f);
	}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:7,代码来源:AttackAI.cs

示例14: Awake

	protected virtual void Awake()
	{
		if(Weapon == null)
		{
			Weapon = GetComponent<Weapon>() ?? GetComponentInParent<Weapon>();
		}
	}
开发者ID:Snakybo-School,项目名称:OUTGEFOUND,代码行数:7,代码来源:WeaponComponent.cs

示例15: DetermineCombatLevel

        /// <summary>
        /// Determines the level.
        /// </summary>
        /// <param name="skills">The skills.</param>
        /// <param name="weapon">The weapon.</param>
        public static int DetermineCombatLevel(SkillsContainer skills, Weapon weapon)
        {
            double a = skills.Attack + weapon.APoints;
            double d = skills.Defense / skills.Handicap;

            return Convert.ToInt32(Math.Ceiling(a + d));
        }
开发者ID:philippdolder,项目名称:CleanCode.Academy,代码行数:12,代码来源:LevelCalculationHelper.cs


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