public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback) { if (enemies == null) { Utils.Logger.GetInstance().Error("enemies is null"); onOverCallback(); return; } SquadUnitController[] units = enemies.GetAllUnits(); if (units == null || units.Length <= 0) { Utils.Logger.GetInstance().Error("Failed to get enemy units"); onOverCallback(); return; } AttackAnimation.DoAnimation(units[0].transform.parent.position, () => { foreach (SquadUnitController unit in units) { if (unit.Damagable != null) { unit.Damagable.ReceiveDamage(strength); } } }, () => { onOverCallback(); }); }
public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback) { if (enemies == null) { Utils.Logger.GetInstance().Error("enemies is null"); onOverCallback(); return; } SquadUnitController[] distancelineEnemies = enemies.GetDistanceLineUnits(); if (distancelineEnemies == null || distancelineEnemies.Length <= 0) { Utils.Logger.GetInstance().Message("failed to get distanceline enemies"); onOverCallback(); return; } SquadUnitController enemy = distancelineEnemies[Randomizer.Range(0, distancelineEnemies.Length)]; if (enemy == null || enemy.Damagable == null) { onOverCallback(); return; } AttackAnimation.DoAnimation(enemy.transform.position, () => { enemy.Damagable.ReceiveDamage(strength); }, () => { onOverCallback(); }); }
public override void DoAction(float strength, SquadContainer teammates, SquadContainer enemies, SimpleCallbackDelegate onOverCallback) { if (teammates == null) { Utils.Logger.GetInstance().Error("teammates is null"); onOverCallback(); return; } SquadUnitController[] teammatesArray = teammates.GetAllUnits(); if (teammatesArray == null || teammatesArray.Length <= 0) { Utils.Logger.GetInstance().Message("failed to get teammates"); onOverCallback(); return; } AttackAnimation.DoAnimation(teammatesArray[0].transform.parent.position, () => { foreach (SquadUnitController teammate in teammatesArray) { if (teammate.Healable != null) { teammate.Healable.ReceiveHeal(strength); } } }, () => { onOverCallback(); }); }
public void ResolveAttack() { if (GameManager.CurrentState != FightState.ConfrontState) { return; } if (Player1.ChosenAttacks.Count == 0) { GameManager.ConfrontIsOver(); return; } Attack attack1 = Player1.ChosenAttacks.Dequeue(); Attack attack2 = Player2.ChosenAttacks.Dequeue(); AttackAnimation anim1 = Player1.ChosenAttacksAnim.Dequeue(); AttackAnimation anim2 = Player2.ChosenAttacksAnim.Dequeue(); Move1Started.Invoke(attack1.Image); Move2Started.Invoke(attack2.Image); if (attack1.Fervor != attack2.Fervor) { Player1.Fervor.Value += attack1.Fervor - attack2.Fervor; Player2.Fervor.Value += attack2.Fervor - attack1.Fervor; } anim1.StartAnimation(Attack1EndStatus); Player1.GetComponentInChildren <Animator>().SetTrigger(anim1.triggerName); anim2.StartAnimation(Attack2EndStatus); Player2.GetComponentInChildren <Animator>().SetTrigger(anim2.triggerName); result1.Reset(); result2.Reset(); Attack1EndStatus.Value = false; attack1.ResolveAttack(Player1, Player2, attack2, result1, result2); Attack2EndStatus.Value = false; attack2.ResolveAttack(Player2, Player1, attack1, result2, result1); CreatePopups(); if (Player1.Population.Value <= 0) { GameManager.CallGameOver(Player2); } if (Player2.Population.Value <= 0) { GameManager.CallGameOver(Player1); } }
// Start is called before the first frame update void Start() { deathCam.enabled = false; if (maxHp / 2 > hearts.Length) { throw new Exception("more Hp than max hearts possible"); } animator = GetComponent <AttackAnimation>(); sufferingAnimate = GetComponent <SufferingAnimate>(); updateHearts(); canvasPause = GameObject.Find("CanvasPauseMenu"); canvasDeath = GameObject.Find("CanvasDeathMenu"); }
public override void Attack() { if (swordSpawn == null) { swordSpawn = GameObject.Find("SwordLocation").GetComponent <Transform>(); } if (AttackAnimation == null) { AttackAnimation = GameObject.Find("Player").GetComponent <Animator>(); } cloneSword = (GameObject)Instantiate(Sword1, swordSpawn.position, swordSpawn.rotation); cloneSword.transform.parent = swordSpawn; AttackAnimation.SetTrigger("SwordAttack"); }
public static bool PlayAttackAnimation(this Mobile m, AttackAnimation a) { if (m == null || m.Deleted) { return(false); } var info = GetAttackAnimation(m, a); if (info != AnimationInfo.Empty) { return(info.Animate(m)); } return(false); }
protected virtual void Start() { speed = new Vector2(0, 0); direction = CharacterDirection.DOWN; status = CharacterStatus.IDLE; baseSprite = transform.Find("BaseSprite").gameObject; spriteRenderer = baseSprite.GetComponent <SpriteRenderer>(); effectParent = transform.Find("EffectParent").gameObject; shadowParent = transform.Find("ShadowParent").gameObject; idleAnimation = GetComponent <IdleAnimation>(); walkAnimation = GetComponent <WalkAnimation>(); damageAnimation = GetComponent <DamageAnimation>(); attackAnimation = GetComponent <AttackAnimation>(); GameManager instaince = GameManager.Instance; GameObject shadow = instaince.spriteFactory.instatiateShadow(shadowParent, SpriteFactory.ShadowType.Midiam); shadow.transform.Translate(new Vector3(0, 0, -1)); }
public override void Attack(AttackDirection direction) { if (!IsReadyForAttack) { combo.Clear(); return; } if (CurrentAttack == AttackDirection.None) { combo.Clear(); } combo.Add(direction); AttackAnimation anim = attackAnimpack.GetAttack(combo); if (anim != null) { Animate(anim.Data); } else { combo.Clear(); } }
public void SetUp(eMapElement eElement) { _MapManager = GameObject.Find("MapManager").GetComponent <MapManager>(); // ワールド座標の開始位置をマップデータに入力する int x = _MapManager.ToGridX(transform.position); int y = _MapManager.ToGridY(transform.position); _MapManager.SetData(x, y, eElement); // マップデータからワールド座標を決める transform.position = _MapManager.ToWorldPosition(x, y); _MessageMan = GameObject.Find("MessageManager").GetComponent <MessageManager>(); _Attack = GetComponent <AttackAnimation>(); if (_Attack != null) { _Attack.SetUp(); } _GameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("AnimationType", true, out subEle); subEle.Value = AnimationType.ToString(); ele.TryPathTo("AnimationMultiplier", true, out subEle); subEle.Value = AnimationMultiplier.ToString("G15"); ele.TryPathTo("Reach", true, out subEle); subEle.Value = Reach.ToString("G15"); ele.TryPathTo("Flags1", true, out subEle); subEle.Value = Flags1.ToString(); ele.TryPathTo("GripAnimation", true, out subEle); subEle.Value = GripAnimation.ToString(); ele.TryPathTo("AmmoUse", true, out subEle); subEle.Value = AmmoUse.ToString(); ele.TryPathTo("ReloadAnimation", true, out subEle); subEle.Value = ReloadAnimation.ToString(); ele.TryPathTo("MinSpread", true, out subEle); subEle.Value = MinSpread.ToString("G15"); ele.TryPathTo("Spread", true, out subEle); subEle.Value = Spread.ToString("G15"); ele.TryPathTo("Unknown", true, out subEle); subEle.Value = Unknown.ToHex(); ele.TryPathTo("SightFOV", true, out subEle); subEle.Value = SightFOV.ToString("G15"); ele.TryPathTo("Unknown2", true, out subEle); subEle.Value = Unknown2.ToString("G15"); ele.TryPathTo("Projectile", true, out subEle); Projectile.WriteXML(subEle, master); ele.TryPathTo("BaseVATSToHitChance", true, out subEle); subEle.Value = BaseVATSToHitChance.ToString(); ele.TryPathTo("AttackAnimation", true, out subEle); subEle.Value = AttackAnimation.ToString(); ele.TryPathTo("ProjectileCount", true, out subEle); subEle.Value = ProjectileCount.ToString(); ele.TryPathTo("EmbeddedWeaponActorValue", true, out subEle); subEle.Value = EmbeddedWeaponActorValue.ToString(); ele.TryPathTo("Range/Min", true, out subEle); subEle.Value = MinRange.ToString("G15"); ele.TryPathTo("Range/Max", true, out subEle); subEle.Value = MaxRange.ToString("G15"); ele.TryPathTo("LimbKillBehavior", true, out subEle); subEle.Value = LimbKillBehavior.ToString(); ele.TryPathTo("Flags2", true, out subEle); subEle.Value = Flags2.ToString(); ele.TryPathTo("AttackAnimationMultiplier", true, out subEle); subEle.Value = AttackAnimationMultiplier.ToString("G15"); ele.TryPathTo("FireRate", true, out subEle); subEle.Value = FireRate.ToString("G15"); ele.TryPathTo("ActionPointCost", true, out subEle); subEle.Value = ActionPointCost.ToString("G15"); ele.TryPathTo("Rumble/LeftMotorStrength", true, out subEle); subEle.Value = RumbleLeftMotorStrength.ToString("G15"); ele.TryPathTo("Rumble/RightMotorStrength", true, out subEle); subEle.Value = RumbleRightMotorStrength.ToString("G15"); ele.TryPathTo("Rumble/Duration", true, out subEle); subEle.Value = RumbleDuration.ToString("G15"); ele.TryPathTo("DamageToWeaponMult", true, out subEle); subEle.Value = DamageToWeaponMult.ToString("G15"); ele.TryPathTo("AttackShotsPerSecond", true, out subEle); subEle.Value = AttackShotsPerSecond.ToString("G15"); ele.TryPathTo("ReloadTime", true, out subEle); subEle.Value = ReloadTime.ToString("G15"); ele.TryPathTo("JamTime", true, out subEle); subEle.Value = JamTime.ToString("G15"); ele.TryPathTo("AimArc", true, out subEle); subEle.Value = AimArc.ToString("G15"); ele.TryPathTo("Skill", true, out subEle); subEle.Value = Skill.ToString(); ele.TryPathTo("Rumble/Pattern", true, out subEle); subEle.Value = RumblePattern.ToString(); ele.TryPathTo("Rumble/Wavelength", true, out subEle); subEle.Value = RumbleWavelength.ToString("G15"); ele.TryPathTo("LimbDamageMult", true, out subEle); subEle.Value = LimbDamageMult.ToString("G15"); ele.TryPathTo("ResistanceType", true, out subEle); subEle.Value = ResistanceType.ToString(); ele.TryPathTo("SightUsage", true, out subEle); subEle.Value = SightUsage.ToString("G15"); ele.TryPathTo("SemiAutomaticFireDelay/Min", true, out subEle); subEle.Value = SemiAutomaticFireDelayMin.ToString("G15"); ele.TryPathTo("SemiAutomaticFireDelay/Max", true, out subEle); subEle.Value = SemiAutomaticFireDelayMax.ToString("G15"); ele.TryPathTo("Unknown3", true, out subEle); subEle.Value = Unknown3.ToString("G15"); ele.TryPathTo("Mods/Mod1/Effect", true, out subEle); subEle.Value = Mod1Effect.ToString(); ele.TryPathTo("Mods/Mod2/Effect", true, out subEle); subEle.Value = Mod2Effect.ToString(); ele.TryPathTo("Mods/Mod3/Effect", true, out subEle); subEle.Value = Mod3Effect.ToString(); ele.TryPathTo("Mods/Mod1/ValueA", true, out subEle); subEle.Value = Mod1ValueA.ToString("G15"); ele.TryPathTo("Mods/Mod2/ValueA", true, out subEle); subEle.Value = Mod2ValueA.ToString("G15"); ele.TryPathTo("Mods/Mod3/ValueA", true, out subEle); subEle.Value = Mod3ValueA.ToString("G15"); ele.TryPathTo("PowerAttackAnimation", true, out subEle); subEle.Value = PowerAttackAnimation.ToString(); ele.TryPathTo("StrengthRequirement", true, out subEle); subEle.Value = StrengthRequirement.ToString(); ele.TryPathTo("Unknown4", true, out subEle); subEle.Value = Unknown4.ToString(); ele.TryPathTo("Mods/Mod1/ReloadAnimation", true, out subEle); subEle.Value = Mod1ReloadAnimation.ToString(); ele.TryPathTo("Unknown5", true, out subEle); subEle.Value = Unknown5.ToHex(); ele.TryPathTo("AmmoRegenRate", true, out subEle); subEle.Value = AmmoRegenRate.ToString("G15"); ele.TryPathTo("KillImpulse", true, out subEle); subEle.Value = KillImpulse.ToString("G15"); ele.TryPathTo("Mods/Mod1/ValueB", true, out subEle); subEle.Value = Mod1ValueB.ToString("G15"); ele.TryPathTo("Mods/Mod2/ValueB", true, out subEle); subEle.Value = Mod2ValueB.ToString("G15"); ele.TryPathTo("Mods/Mod3/ValueB", true, out subEle); subEle.Value = Mod3ValueB.ToString("G15"); ele.TryPathTo("ImpulseDistance", true, out subEle); subEle.Value = ImpulseDistance.ToString("G15"); ele.TryPathTo("SkillRequirement", true, out subEle); subEle.Value = SkillRequirement.ToString(); }
public static Animations ToAnimations(this AttackAnimation value) { return(EnumConverter.ConvertByName <Animations>(value)); }
public static AttackAnimation CreateAttackAnimation() { var anim = new AttackAnimation(); return(anim); }
public override void Attack(GameTime gameTime, HeroEntity hero) { if (gameTime.TotalGameTime.TotalMilliseconds - LastAttackTime < AttackCooldown && DamageCollisionMask == null) { LastAnimation = null; return; } if (gameTime.TotalGameTime.TotalMilliseconds - LastAttackTime >= 70) { DidHitHero = false; Preparing = false; DamageCollisionMask = null; } if (!Attacking && !Preparing) { if (hero.IsInvincible) { return; } //The movement has just been started CurrentWaitInterval = 0; Preparing = true; } LastAttackTime = gameTime.TotalGameTime.TotalMilliseconds; CurrentWaitInterval += gameTime.ElapsedGameTime.TotalMilliseconds; if (Preparing) { /* * //Get in position to attack * Vector2 vct; * bool flag; //Was the animation finished * * base.PlayAnimation(AttackAnimation, gameTime, out vct, out flag); */ if (true) /* if (flag) */ { Preparing = false; //set the damage collision mask, which makes Attacking = true if (this.Effects == Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally) { DamageCollisionMask = new Rectangle( (int)X, (int)Center.Y - 10, 60, 24); } else { DamageCollisionMask = new Rectangle( (int)X + Image.Width - 48, (int)Center.Y - 10, 60, 20); } AttackAnimation.ForceReset(gameTime); } } //Do the attacking movement bool flag; Vector2 vct; base.PlayAnimation(AttackAnimation, gameTime, out vct, out flag); if (flag) //Reset the hole movement { DidHitHero = false; Preparing = false; DamageCollisionMask = null; } }
protected void GetSkillAndAnimForAttack(Item weapon, bool isPrimaryHand, out Skill skill, out AttackAnimation anim) { if (weapon != null && weapon.ItemClass == Item.ITEM_CLASS_COMMON) { switch ((ItemType)weapon.ItemType) { case ItemType.OneHandSlash: skill = Skill.OneHandSlashing; anim = AttackAnimation.OneHandWeapon; break; case ItemType.TwoHandSlash: skill = Skill.TwoHandSlashing; anim = AttackAnimation.TwoHandSlashing; break; case ItemType.Pierce: skill = Skill.Piercing; anim = AttackAnimation.Piercing; break; case ItemType.OneHandBash: skill = Skill.OneHandBlunt; anim = AttackAnimation.OneHandWeapon; break; case ItemType.TwoHandBash: skill = Skill.TwoHandBlunt; anim = AttackAnimation.TwoHandWeapon; break; case ItemType.TwoHandPierce: skill = Skill.Piercing; anim = AttackAnimation.TwoHandWeapon; break; default: skill = Skill.HandToHand; anim = AttackAnimation.HandToHand; break; } } else { skill = Skill.HandToHand; anim = AttackAnimation.HandToHand; } if (!isPrimaryHand) anim = AttackAnimation.DualWield; }
internal AnimationEventArgs(AttackAnimation anim) { Anim = anim; }
public static AnimationInfo GetAttackAnimation(this Mobile m, AttackAnimation a) { if (m == null || m.Deleted) { return(AnimationInfo.Empty); } int animID; switch (m.Body.Type) { case BodyType.Sea: case BodyType.Animal: animID = Utility.Random(5, 2); break; case BodyType.Monster: { switch (a) { case AttackAnimation.ShootBow: case AttackAnimation.ShootXBow: return(AnimationInfo.Empty); default: animID = Utility.Random(4, 3); break; } } break; case BodyType.Human: { if (!m.Mounted) { animID = (int)a; break; } switch (a) { case AttackAnimation.ShootBow: animID = 27; break; case AttackAnimation.ShootXBow: animID = 28; break; case AttackAnimation.Bash2H: case AttackAnimation.Pierce2H: case AttackAnimation.Slash2H: animID = 29; break; default: animID = 26; break; } } break; default: return(AnimationInfo.Empty); } return(new AnimationInfo(animID, 7)); }
/// <summary> /// Update de enemy /// </summary> /// <param name="gameTime">GameTime object die we kunnen gebruiken om de tijd te meten</param> /// <param name="collider">Collider object dat we gebruiken of er collision gebeurt bij de enemy</param> /// <param name="collisionObjects">Lijst met alle objecten die kunnen colliden</param> public void Update(GameTime gameTime, Collider collider, List <ICollide> collisionObjects) { collider.CollisionDetect(collisionObjects, this); if (TouchingGround) { ChangeVelocity(MovingSpeed, 0); } if (TouchingLeft && Velocity.Y == 0) { IsLookingLeft = false; ChangeVelocity(MovingSpeed, null); } if (TouchingRight && Velocity.Y == 0) { IsLookingLeft = true; ChangeVelocity(-MovingSpeed, null); } if (IsHit) { AmountOfHitsEnemyCanTake--; IsHit = false; ChangeVelocity(0, null); if (AmountOfHitsEnemyCanTake <= 0) { CurrentAnimation = DeathAnimation; } else { CurrentAnimation = HurtAnimation; } } if (HurtAnimation != null && CurrentAnimation.CurrentFrame == HurtAnimation.frames[HurtAnimation.frames.Count - 1]) { CurrentAnimation = RunAnimation; if (IsLookingLeft) { ChangeVelocity(-MovingSpeed, null); } else { ChangeVelocity(MovingSpeed, null); } HurtAnimation.Reset(); } if (Attack) { CurrentAnimation = AttackAnimation; ChangeVelocity(0, null); if (CurrentAnimation.CurrentFrame == AttackAnimation.frames[AttackAnimation.frames.Count - 1]) { Attack = false; CurrentAnimation = RunAnimation; if (IsLookingLeft) { ChangeVelocity(-MovingSpeed, null); } else { ChangeVelocity(MovingSpeed, null); } } } else { AttackAnimation.Reset(); } Position += Velocity; if (CurrentAnimation.CurrentFrame == DeathAnimation.frames[DeathAnimation.frames.Count - 1]) { collisionObjects.Remove(this); } widthOfFrame = CurrentAnimation.CurrentFrame.scale * CurrentAnimation.CurrentFrame.RectangleSelector.Width; heightOfFrame = CurrentAnimation.CurrentFrame.scale * CurrentAnimation.CurrentFrame.RectangleSelector.Height; CurrentAnimation.Update(gameTime); }
/// Loads required resources for this creature public override void load(ContentManager content) { base.load(content); AbilityFiles.ForEach(af => { Ability ability = content.Load <Ability>(af); if (Abilities.Where(a => a.Title == ability.Title).Count() == 0) { addAbility(ability.clone() as Ability); } }); Abilities.ForEach(a => a.load(content)); if (DeathSoundFile != null) { DeathSound = content.Load <SoundEffect>(DeathSoundFile); } if (AttackSoundFile != null) { AttackSound = content.Load <SoundEffect>(AttackSoundFile); } if (DamageSoundFile != null) { DamageSound = content.Load <SoundEffect>(DamageSoundFile); } if (LevelUpSoundFile != null) { LevelUpSound = content.Load <SoundEffect>(LevelUpSoundFile); } if (DeathAnimationAsset != null) { DeathAnimationAsset.load(content); } if (AttackAnimationAsset != null) { AttackAnimationAsset.load(content); } if (DamageAnimationAsset != null) { DamageAnimationAsset.load(content); } if (LevelUpAnimationAsset != null) { LevelUpAnimationAsset.load(content); } if (DeathAnimation != null) { DeathAnimation.load(content); DeathAnimation.Origin = this; } if (AttackAnimation != null) { AttackAnimation.load(content); AttackAnimation.Origin = this; } if (DamageAnimation != null) { DamageAnimation.load(content); DamageAnimation.Origin = this; } if (LevelUpAnimation != null) { LevelUpAnimation.load(content); LevelUpAnimation.Origin = this; } if (ClassAsset != null) { ClassAsset.load(content); } if (Class != null) { Class.Creature = this; } }