本文整理汇总了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);
}
}
示例2: DTRMStart
public override void DTRMStart()
{
base.DTRMStart();
attack = GetComponent<Attack>();
legs = GetComponent<Legs>();
}
示例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;
}
}
示例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>();
}
}
示例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();
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例10: OnReceiveAttack
public void OnReceiveAttack(Attack attack)
{
// TODO: Calculate skill effects, evade, block, etc.
ReceiveDamage(attack);
// ReceiveKnockback(attack.knockback);
}
示例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();
}
示例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;
}
}
}
}
示例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;
}
示例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;
}
示例15: SmallAttack
public void SmallAttack(Attack atk)
{
if(atk.Value >0)
{
this.m_Animator.SetTrigger(this.AttackSmall);
Invoke("Hurt", hurtDelay);
}
}