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


C# Attack类代码示例

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


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

示例1: Think

    /*
     * Decide what the character should do.
     */
    public override void Think()
    {
        FindTarget ();
        Transform fighterTarget = fighter.GetTarget ();
        // Fall back to patrol if we have no target.
        if (fighterTarget == null) {
            return;
        }

        if (fighter.IsAttacking ()) {
            return;
        }

        if (nextAttack == null) {
            nextAttack = GetNextAttack ();
        }
        // Use the attack, or else walk up to the target if not in range
        // If enemy doesn't have half it's stamina, it will back up.
        if (nextAttack != null && IsTargetInRange (nextAttack)) {
            fighter.SwingWeapon (nextAttack);
            nextAttack = null;
        } else if (stamina.HasAnyStamina ()){
            Vector3 moveDirection = fighterTarget.position - transform.position;
            fighter.Run (moveDirection);
        } else {
            Vector3 moveDirection = transform.position - fighterTarget.position;
            fighter.Run (moveDirection);
        }
    }
开发者ID:redbluegames,项目名称:gladiators,代码行数:32,代码来源:FighterAI.cs

示例2: DTRMStart

    public override void DTRMStart()
    {
        base.DTRMStart();

        attack = GetComponent<Attack>();
        legs = GetComponent<Legs>();
    }
开发者ID:golergka,项目名称:KingOfCastles,代码行数:7,代码来源:ProjectileController.cs

示例3: OnClick

    public void OnClick()
    {
        if(player.TurnPhases == 4){

            //Reset time for arrowColorChange
            arrowColorTimer =(float)(Time.time + .20);
            arrow.color = Color.red;

            stopPosition = arrow.transform.localPosition;

            currentAttack = didLand(currentAttack);

            startTimer = Time.time + 1;

            if(currentAttack == Attack.Hit){
                arrow.transform.localPosition = initialPosition;

                triesCounter++;
                player.triesCounter++;

                clickCounter++;
                player.clickCounter++;

                ArrowSpeed += 100;
            }

            player.lastSwordHit = (Player.LastSwordHit) currentAttack;
        }
    }
开发者ID:RohanKarnik,项目名称:StreetNinja,代码行数:29,代码来源:SwordMiniGameScript.cs

示例4: Awake

    public virtual void Awake()
    {
        agent = gameObject.GetComponent<NavMeshAgent>();

        //Patrol instance START
        points = new Vector3[patrolWaypoints.Length];

        for(int i=0; i<patrolWaypoints.Length; i++ ){
            if(!moveYAxis){
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, transform.position.y, patrolWaypoints[i].transform.position.z);
            }else{
                points[i] = new Vector3(patrolWaypoints[i].transform.position.x, patrolWaypoints[i].transform.position.y, patrolWaypoints[i].transform.position.z);
            }
        }

        if(points.Length == 1){
            vectorIndex = 0;
        }
        //Patrol instance END

        enemyStats = GetComponent<EnemyStats>();
        enemyAttack = GetComponent<Attack>();
        enemyAttack.setMoveYAxis(moveYAxis);

        if(enemyStats.spriteObject != null){
            enemyAnimator = enemyStats.spriteObject.GetComponent<Animator>();
            hashAnimator = enemyStats.spriteObject.GetComponent<HashAnimatorUnit>();
        }
    }
开发者ID:andre-cabral,项目名称:mobile-RTS,代码行数:29,代码来源:PatrolAndStalkMovement.cs

示例5: BT_Add_Click

 private void BT_Add_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Attack retVal = new Attack()
         {
             // Basics
             Name              = TB_Name.Text != "" ? TB_Name.Text : "Dynamic",
             DamageType        = (ItemDamageType)CB_DmgType.SelectedIndex,
             DamagePerHit      = (float)NUD_DmgPerHit.Value,
             DamageIsPerc      = CK_DamageIsPerc.IsChecked.GetValueOrDefault(false),
             MaxNumTargets     = (float)NUD_MaxNumTargs.Value,
             AttackSpeed       = (float)NUD_AtkSpeed.Value,
             AttackType        = (ATTACK_TYPES)CB_AtkType.SelectedIndex,
             // Phase Info
             //PhaseStartTime    = (float)NUD_PhaseStartTime.Value,
             //PhaseEndTime      = (float)NUD_PhaseEndTime.Value,
             // DoT Stats
             IsDoT             = CK_IsDoT.IsChecked.GetValueOrDefault(false),
             DamagePerTick     = (float)NUD_DmgPerTick.Value,
             TickInterval      = (float)NUD_TickInterval.Value,
             Duration          = (float)NUD_Duration.Value,
             // Advanced
             Interruptable     = CK_Interruptable.IsChecked.GetValueOrDefault(false),
             IsTheDefaultMelee = CK_IsDefaultMelee.IsChecked.GetValueOrDefault(false),
             IsDualWielding    = CK_IsDualWielding.IsChecked.GetValueOrDefault(false),
             IsFromAnAdd       = CK_IsFromAnAdd.IsChecked.GetValueOrDefault(false),
             // Player Avoidances
             Missable          = (bool)CK_Missable.IsChecked,
             Dodgable          = (bool)CK_Dodgable.IsChecked,
             Parryable         = (bool)CK_Parryable.IsChecked,
             Blockable         = (bool)CK_Blockable.IsChecked,
         };
         // Targeting Includes
         retVal.AffectsRole[PLAYER_ROLES.MainTank]             = CK_AffectsMTank.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.OffTank]              = CK_AffectsOTank.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.TertiaryTank]         = CK_AffectsTTank.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.MeleeDPS]             = CK_AffectsMeleeDPS.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.RangedDPS]            = CK_AffectsRangedDPS.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.MainTankHealer]       = CK_AffectsMainTankHealer.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.OffAndTertTankHealer] = CK_AffectsOffTankHealer.IsChecked.GetValueOrDefault(false);
         retVal.AffectsRole[PLAYER_ROLES.RaidHealer]           = CK_AffectsRaidHealer.IsChecked.GetValueOrDefault(false);
         //
         if (isEditing) {
             // Affect your changes to the currently selected one
             isEditing = false;
             int index = LB_TheList.SelectedIndex;
             TheList.RemoveAt(LB_TheList.SelectedIndex);
             TheList.Insert(index, retVal);
         } else { TheList.Add(retVal); }
         SetListBox();
     } catch (Exception ex) {
         new Base.ErrorBox()
         {
             Title = "Error Adding a Boss Attack",
             Function = "BT_Add_Clicked()",
             TheException = ex,
         }.Show();
     }
 }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:60,代码来源:DG_BossAttacks.xaml.cs

示例6: Hit

 /// <summary>
 /// Called by other hitboxes when an attack connects.
 /// This is called BY the affecting, ON the affected.
 /// </summary>
 /// <param name="attack">The attack this hitbox is being hit with.</param>
 public override void Hit(Attack attack)
 {
     if (debug) {
         Debug.Log (gameObject.name + " has been hit by " + attack.kData.name);
     }
     switch (state) {
         case State.Normal:
             m_hitManager.AddAttack (attack);
             break;
         case State.Block:
             attack.damageMultiplier *= attack.kData.Chip;
             attack.launchScale.x = blockingLaunchScale;
             attack.launchScale.y = (m_parent.Grounded ? 0 : blockingLaunchScale);
             attack.wasBlocked = true;
             goto case State.Normal;
         case State.Attack:
             if (attack.kData.Priority > m_attack.Priority) goto case State.Normal;
             else if (attack.kData.Priority == m_attack.Priority)
                 m_hitManager.AddAttack (GenerateAttack(m_conflcitResolution));
             break;
         default:
             Debug.LogError (InvalidStateSelectionError);
             goto case State.Normal;
     }
 }
开发者ID:UTC-SkillsUSA-2015,项目名称:SkillsUSA-2015,代码行数:30,代码来源:FighterHitbox.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        Attack tackle = new Attack ();
        Attack tackle2 = new Attack ();
        Attack tackle3 = new Attack ();
        Attack tackle4 = new Attack ();

        Pokemon nikuh = new Pokemon ();

        tackle.aname = "Milchmelker";
        tackle.ap = 30;
        tackle.maxAp = 30;
        tackle.precise = 100;
        tackle.strenght = 10;
        tackle.type = Attack.Type.physical;

        tackle2.aname = "Gemuhe";
        tackle2.ap = 20;
        tackle2.maxAp = 30;
        tackle2.precise = 100;
        tackle2.strenght = 10;
        tackle2.type = Attack.Type.physical;

        tackle3.aname = "Hufstampfer";
        tackle3.ap = 10;
        tackle3.maxAp = 30;
        tackle3.precise = 100;
        tackle3.strenght = 10;
        tackle3.type = Attack.Type.physical;

        tackle4.aname = "Dubstepkanone";
        tackle4.ap = 40;
        tackle4.maxAp = 50;
        tackle4.precise = 100;
        tackle4.strenght = 10;
        tackle4.type = Attack.Type.physical;

        nikuh.name = "Nikuh";
        nikuh.attack = 20;
        nikuh.defense = 15;
        nikuh.specialAttack = 13;
        nikuh.specialDefense = 8;
        nikuh.experience = 300;
        nikuh.level = 6;
        nikuh.id = 0;
        nikuh.pokedexId = 1;
        nikuh.trainer = InterSceneData.main.playerName;
        nikuh.types = new Pokemon.Type[10];
        nikuh.types [0] = Pokemon.Type.grass;
        nikuh.maxHp = 50;
        nikuh.hp = 50;
        nikuh.picture = Resources.LoadAll<Sprite> ("Sprites/pokemon_battle")[245];
        nikuh.attacks = new Attack[4];
        nikuh.attacks [0] = tackle;
        nikuh.attacks [1] = tackle2;
        nikuh.attacks [2] = tackle3;
        nikuh.attacks [3] = tackle4;

        insertPokemon (nikuh);
    }
开发者ID:stone3311,项目名称:Thomasmon,代码行数:61,代码来源:TrainerPokemonDatabase.cs

示例8: addAttack

        /**
         * {@inheritDoc}
         */
        //@Override
        //@POST
        //@Path("/attacks")
        public void addAttack(Attack attack) { // throws NotAuthorizedException
            accessControlUtils.checkAuthorization(org.owasp.appsensor.accesscontrol.Action.ADD_ATTACK, requestContext);

            attack.setDetectionSystemId(getClientApplicationName());

            appSensorServer.getAttackStore().addAttack(attack);
        }
开发者ID:Borealix,项目名称:AppSensor2.NET,代码行数:13,代码来源:WCFRequestHandler.cs

示例9: Update

    // Update is called once per frame
    void Update()
    {
        if (ChoseToAttack) {
            PlayerAttack = FIGHTscreen.S.ChosenAttack;
            ChoseToAttack = false;

            if(PlayersPokemon.SpeedStat > EnemyPokemon.SpeedStat) {
                int dmg = Damage (PlayersPokemon, EnemyPokemon, PlayerAttack);
                EnemyPokemon.HealthCurrent -= dmg;
                if(EnemyPokemon.HealthCurrent > 0) {
                    Attack att = EnemyAI (EnemyPokemon);
                    dmg = Damage(EnemyPokemon, PlayersPokemon, att);
                    PlayersPokemon.HealthCurrent -= dmg;
                }
            } else {
                Attack att = EnemyAI (EnemyPokemon);
                int dmg = Damage(EnemyPokemon, PlayersPokemon, att);
                PlayersPokemon.HealthCurrent -= dmg;
                if(PlayersPokemon.HealthCurrent > 0) {
                    dmg = Damage(PlayersPokemon, EnemyPokemon, PlayerAttack);
                    EnemyPokemon.HealthCurrent -= dmg;
                }
            }
            print (PlayersPokemon.Name + " HP: " + PlayersPokemon.HealthCurrent + "/" + PlayersPokemon.HealthFull);
            print (EnemyPokemon.Name + " HP: " + EnemyPokemon.HealthCurrent + "/" + EnemyPokemon.HealthFull);
        } else if (ChoseToRun) {
            //say Ran Away
            ChoseToRun = false;
            gameObject.SetActive(false);
        }
    }
开发者ID:grackend,项目名称:pokemonv1,代码行数:32,代码来源:Battle.cs

示例10: OnReceiveAttack

    public void OnReceiveAttack(Attack attack)
    {
        // TODO: Calculate skill effects, evade, block, etc.

        ReceiveDamage(attack);
        //        ReceiveKnockback(attack.knockback);
    }
开发者ID:mateoKlab,项目名称:AMD,代码行数:7,代码来源:FighterController.cs

示例11: Start

    // Use this for initialization
    void Start()
    {
        // Setup first

        Setup();

        // Set attack

        attackSet = new Attack[1];
        attackSet[0] = new Attack("Shoot", "fire an arrow at", "try to hit", 3, 2, 6, "pierce", 1, "arrow");
        attackSet[0].spCost = 2;
        attackSet[0].hitSound = "hit1";
        attackSet[0].startSound = "shoot1";
        attackSet[0].failSound = "miss1";

        // Set details

        descShort = "An unidentified shortbow.";

        if(effectMain == "normal"){

            descShortHidden = "A common shortbow.";

        }else{

            descShortHidden = "A shortbow of "+effectMain+".";

        }

        descLong = "Shortbows are light ranged weapons which use arrows.";

        // Apply effects to attacks

        ApplyEffectsToAttacks();
    }
开发者ID:scott-hamp,项目名称:Wildshore-Roguelike,代码行数:36,代码来源:Shortbow.cs

示例12: FixedUpdate

	// Update is called once per frame
	void FixedUpdate () {

		UpdateCoolDowns ();

		if (!attacking) {

			timeSinceLastAttack += Time.fixedDeltaTime;

			if (withinMeleeRange) {
				if (nextAttack == null) {
					//Debug.Log ("Dont have an attack so lets choose a new one");
					nextAttack = DetermineNextMove ();
				}

				if (!nextAttack.isOnCoolDown () && timeSinceLastAttack >= attackRate) {
					attacking = true;
					timeSinceLastAttack = 0f;
					anim.SetInteger ("CurrentAction", nextAttack.getCurrentActionInt ());
					// set the attack for the cooldown
					nextAttack.startCooldown();
					//Debug.Log (nextAttack.getName() + " should hit for: " + damage);

					StartCoroutine (completeTheAttack (nextAttack));
					nextAttack = null;
				}
			}
		}
	}
开发者ID:choobert,项目名称:ArenaBattle,代码行数:29,代码来源:EnemyAttack.cs

示例13: displayEnemyAttack

 public void displayEnemyAttack(Attack attack)
 {
     showText();
     enemyText.text = PlayerPrefs.GetString("EnemyName") + " used " + attack.attackName + "!";
     enemyText.text = enemyText.text += "\n" + attack.attackDescription;
     playerText.text = attack.effectDescription;
 }
开发者ID:blake-mealey,项目名称:2016-CSUS-Hackathon,代码行数:7,代码来源:BattleUIManager.cs

示例14: CalcDamage

    double CalcDamage(Combatant attacker, Combatant defender, Attack attack)
    {
        System.Random gen = new System.Random();
        double crit = 1.0;
        double attackPower = 0.0;
        double defensePower = 0.0;

        //does hit
        if(gen.NextDouble() * 100 > (attack.accuracy + attacker.perception))
        {
            return 0.0;
        }
        //is crit

        if(gen.NextDouble()*100 < (0.05+0.02 * attacker.luck))
        {
            crit = 1.5;
        }
        //do damage
        attackPower = attack.power * attacker.strength;
        defensePower = defender.defense + defender.getArmorValue();

        //return

        return (attackPower / defensePower) * crit;
    }
开发者ID:uwgb-socsc,项目名称:FetchQuest,代码行数:26,代码来源:Combat.cs

示例15: SmallAttack

 public void SmallAttack(Attack atk)
 {
     if(atk.Value >0)
     {
         this.m_Animator.SetTrigger(this.AttackSmall);
         Invoke("Hurt", hurtDelay);
     }
 }
开发者ID:DevonHansen,项目名称:DudeWheresMyCombo,代码行数:8,代码来源:AnimationManager.cs


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