public override void Release(DefAction OnSuccess = null, DefAction OnFinish = null) { targettState = curState = BaseSkillState.Attack01; //播放角色动作 base.Release(OnSuccess, () => { OnReleaseFinish(OnFinish); }); //控制猪脚瞬间移动 WaitForSec(delayTime, () => { FastMove(); }); AudioManager.Instance.PlayAudio(AudioManager.Man_Comm_Attack01); //控制特效显示 PlayEffect(effectGOFirst); //计算伤害值 WaitForSec(DelayCalAttack01DamageTime, () => { AttackItem attack = new AttackItem(); attack.Damage = Damage; attack.Type = AttackType.Normal; attack.Stage = AttackStage.First; attack.AttackDir = AttackDir.Forward; PlayerFightCtrl.Instance.CalculateDamage(attack); }); }
public override void Release(DefAction OnSuccess = null, DefAction OnFinish = null) { base.Release(OnSuccess, OnFinish); WaitForSec(delayTime01, () => { LoadEffect(effect01); }); WaitForSec(damageTime01 / 2, () => { AttackItem attack = GetSkill03AttackItem(); attack.Damage = Damage; attack.Stage = AttackStage.First; CalDamage(attack); }); WaitForSec(delayTime02, () => { LoadEffect(effect02); }); WaitForSec(damageTime02 / 2, () => { AttackItem attack = GetSkill03AttackItem(); attack.Damage = Damage * 2; attack.Stage = AttackStage.Second; CalDamage(attack); }); WaitForSec(delayTime03, () => { LoadEffect(effect03); }); WaitForSec(damageTime03 / 2, () => { AttackItem attack = GetSkill03AttackItem(); attack.Damage = Damage * 3; attack.Stage = AttackStage.Third; CalDamage(attack); }); }
void EquipAttackItemGeneral(GameObject _SlotOnCharacterSprite, AttackItem _attackItem) { _SlotOnCharacterSprite.SetActive(true); _SlotOnCharacterSprite.GetComponent <SpriteRenderer>().sprite = _attackItem._WeaponOnTheCharacterSprite; _EquippedAttackItem = _attackItem; _EquippedAttackItem._equipped = true; }
public void Start() { World w = new World(_maxX, _maxY); Console.WriteLine("The world's range is: " + w); Console.ReadKey(); Creature c = new Creature("Troll", new PositiveInt(750), 35, 20, GameTrace.GT, new Position(2, 5)); Creature c2 = new Creature("Wolfman", new PositiveInt(49), 24, 20, GameTrace.GT, new Position(3, 4)); AttackItem a = new AttackItem("Doom Sword", 34, 3, true, false, new Position(3, 6), GameTrace.GT); AttackItem a2 = new AttackItem("Almighty Sword", 20, 5, true, true, new Position(2, 7), GameTrace.GT); DefenceItem d = new DefenceItem("Protection Shield", 20, true, false, new Position(5, 8), GameTrace.GT); DefenceItem d2 = new DefenceItem("Almighty Shield", 30, false, false, new Position(5, 8), GameTrace.GT); Console.WriteLine("---- The weapons ----"); Console.WriteLine(a); Console.WriteLine(a2); Console.WriteLine(d); Console.WriteLine(d2); Console.ReadKey(); Console.WriteLine("---------"); Console.WriteLine(c); Console.WriteLine("Vs."); Console.WriteLine(c2); Console.ReadKey(); Console.WriteLine("---- " + c.Name + " loots " + a.Name + " and " + d.Name + " ----"); c.LootAttackItem(a); c.LootDefenseItem(d); Console.WriteLine(c); Console.ReadKey(); Console.WriteLine("---- " + c2.Name + " tries to loot " + d2.Name + " ----"); c2.LootDefenseItem(d2); Console.WriteLine(c2); Console.ReadKey(); Console.WriteLine("---- " + c.Name + " tries to loot " + a2.Name + " ----"); c.LootAttackItem(a2); Console.WriteLine(c); Console.ReadKey(); Console.WriteLine("---- " + c.Name + " attacks " + c2.Name + " ----"); c.Hit(); c2.ReceiveHit(c.Hit()); Console.WriteLine(c); Console.WriteLine(c2); GameTrace.GT.Close(); }
private AttackItem GetSkill03AttackItem() { AttackItem item = new AttackItem(); item.Range = 10; item.AttackDir = AttackDir.Forward; item.Type = AttackType.Skill03; return(item); }
public void Test_Initializing_BowAttack_Items() { AttackItem attackItem = _factory.CreateAttackItem("bow", "Bow", 20, 10); Assert.Equal("Bow", attackItem.Name); Assert.Equal(20, attackItem.Damage); Assert.Equal("Bow", attackItem.Type); Assert.Equal(10, attackItem.Range); }
public void Test_Initializing_SwordAttack_Items() { AttackItem attackItem = _factory.CreateAttackItem("sword", "Sting", 40); Assert.Equal("Sting", attackItem.Name); Assert.Equal(40, attackItem.Damage); Assert.Equal("Sword", attackItem.Type); Assert.Equal(1, attackItem.Range); }
public void ChangeUIAttackItem(AttackItem attack_item) { if (attack_item == null) { Attack_Item_Equipped.sprite = Default_Attack_Item_Equipped; return; } Attack_Item_Equipped.sprite = attack_item._Inventory_Icon; }
public void UnEquipWeapons() { if (_EquippedAttackItem != null) { _EquippedAttackItem._equipped = false; } _EquippedAttackItem = null; _Character.MeleeItemCharacterSlot.SetActive(false); _Character.CrossBowItemCharacterSlot.SetActive(false); }
public Chest(bool lootable, string name, bool removable, Position position, AttackItem attackItem, DefenseItem defenseItem) { Id = ChestIdCounter++; Lootable = lootable; Name = name; Removable = removable; Position = position; Symbol = "C"; AttackItem = attackItem; DefenseItem = defenseItem; }
public void UnEquipWeapons() { if (_EquippedAttackItem != null) { _EquippedAttackItem._equipped = false; } _EquippedAttackItem = null; _Character.MeleeItemCharacterSlot.SetActive(false); _Character.CrossBowItemCharacterSlot.SetActive(false); _UIController.ChangeUIAttackItem(null); StartCoroutine(CallUpdateBag(AttackItem)); }
public Goblin(string name, int health, Position position, AttackItem attackItem, DefenseItem defenseItem) { Id = IdCounter++; Name = name; MaxHealth = health; CurrentHealth = MaxHealth; Position = position; Symbol = "G"; AttackItem = attackItem; DefenseItem = defenseItem; MyState.CurrentState = CreatureStates.State.Healthy; }
// This method makes it possible for a creature to loot an attackitem. // If the item is lootable, then it's power is increased by the item's hitpoint and it's added to the list. // If the Item is removable, then the item will lose the power it was increased with and it will be removed from the list. public void LootAttackItem(AttackItem aI) { if (aI.Lootable) { _power = _power + aI.Hitpoint; _worldObjectList.Add(aI); if (aI.Removable) { _power = _power - aI.Hitpoint; _worldObjectList.Remove(aI); } } }
public void Attack() { if (Time.time - lastAttackTime < attackInterval) { // animation.Play("idle"); return; } animation.Play("attack01"); AttackItem attack = new AttackItem(); attack.Damage = Damage; player.GetDamage(attack); lastAttackTime = Time.time; }
public void AddAttackItem(AttackItem item) { var items = AttackItems.FindAll(x => x.Type == item.Type); if (items.Count < 2 && item.Type == AttackEnum.Sword) { AttackItems.Add(item); } else if (items.Count == 0 && item.Type == AttackEnum.Bow) { AttackItems.Add(item); } else { throw new ItemAlreadyEquipped("You cannot equip this item: " + item.Type + " as you already have a maximum of these items equipped"); } }
public virtual void GetAttackDamage(AttackItem attack, DefAction OnFinish = null) { ShowBloodAndSound(); switch (attack.Stage) { case AttackStage.First: GetAttack01Damage(attack, OnFinish); break; case AttackStage.Second: GetAttack02Damage(attack, OnFinish); break; case AttackStage.Third: GetAttack03Damage(attack, OnFinish); break; } }
private void ReleaseAttack02(DefAction OnFinish) { AudioManager.Instance.PlayAudio(AudioManager.Man_Comm_Attack02); GameTools.LogError("ReleaseAttack02222"); animMgr.PlayClip(attack02Clip, () => { OnReleaseFinish(OnFinish); }); WaitForSec(DelayCalAttack02DamageTime, () => { AttackItem attack = new AttackItem(); attack.Damage = Damage * 2; attack.Type = AttackType.Normal; attack.Stage = AttackStage.Second; attack.AttackDir = AttackDir.Forward; PlayerFightCtrl.Instance.CalculateDamage(attack); }); }
public void EquipAttackItem(AttackItem item) { UnEquipWeapons(); if (item == null) { //Bare Hand Equipped return; } if (item._WeaponType == AttackWeaponType.Melee) { EquipAttackItemGeneral(_Character.MeleeItemCharacterSlot, item); } else if (item._WeaponType == AttackWeaponType.CrossBow) { EquipAttackItemGeneral(_Character.CrossBowItemCharacterSlot, item); } }
public void AnimationAttackFinish(float AttackSpeed, AttackItem equipped) { if (equipped == null) { //Bare Hands Attack Finish return; } if (equipped._WeaponType == AttackWeaponType.Melee) { //Melee Satart AttackMeleeFinish(AttackSpeed); } else if (equipped._WeaponType == AttackWeaponType.CrossBow) { //Cross Bow Start CrossBowRelease(AttackSpeed); } }
public override void Release(DefAction OnSuccess = null, DefAction OnFinish = null) { base.Release(OnSuccess, OnFinish); AudioManager.Instance.PlayAudio(AudioManager.Skill_Two); WaitForSec(effect01Time, () => { LoadEffect(effect01); }); WaitForSec(effect02Time, () => { LoadEffect(effect02); }); WaitForSec(effect03Time, () => { LoadEffect(effect03); }); WaitForSec(effect04Time, () => { LoadEffect(effect04); }); WaitForSec(attackTime, () => { AttackItem attack = new AttackItem(); attack.Damage = Damage; attack.Type = AttackType.Skill02; attack.AttackDir = AttackDir.Around; attack.Range = 5; PlayerFightCtrl.Instance.CalculateDamage(attack); }); }
public override void Release(DefAction OnSuccess = null, DefAction OnFinish = null) { base.Release(OnSuccess, OnFinish); //播放声音 AudioManager.Instance.PlayAudio(AudioManager.SKill_One); //播放特效 WaitForSec(Effect01Time, () => { PlayEffect(effect01); }); WaitForSec(Effect02Time, () => { PlayEffect(effect02); }); WaitForSec(Effect03Time, () => { PlayEffect(effect03); }); //计算伤害 WaitForSec(CalDamageTime, () => { AttackItem attack = new AttackItem(); attack.Damage = Damage; attack.Type = AttackType.Skill01; attack.AttackDir = AttackDir.Around; attack.Range = 5; PlayerFightCtrl.Instance.CalculateDamage(attack); }); }
public void CalculateDamage(AttackItem attack) { List <EnemyBase> enemies = EnemyMgr.GetEnemies((enemy) => { bool isInRange = Vector3.Distance(transform.position, enemy.transform.position) < attack.Range; bool isDir = false; if (attack.AttackDir == AttackDir.Around) { isDir = true; } else { Vector3 enemyRelativePos = transform.InverseTransformVector(enemy.transform.position); Vector3 meToEnemyVector = enemy.transform.position - transform.position; float factor = Vector3.Dot(meToEnemyVector, transform.forward); if ((attack.AttackDir == AttackDir.Forward && factor > 0) || (attack.AttackDir == AttackDir.Back && factor < 0)) { isDir = true; } else { isDir = false; } } return(isDir && isInRange); }); if (enemies == null || enemies.Count == 0) { return; } for (int i = 0; i < enemies.Count; i++) { enemies[i].GetDamage(attack); } }
public virtual void GetDamage(AttackItem attack, DefAction OnFinish = null) { // GameTools.LogError(attack.Type + "====> "+attack); handleDict[attack.Type](attack, OnFinish); CalDamage(attack); }
protected virtual void GetAttack03Damage(AttackItem attack, DefAction OnFinish = null) { }
private static void GetItem(IItem itemDto, User currentUser, UnitOfWork unitOfWork) { var itemArgs = itemDto.ToString().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); var type = itemArgs[0]; var part = itemArgs[1]; if (itemArgs.Length == 4) { switch (part) { case "Sword": var sword = new Sword { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var attackItem = new AttackItem { ItemType = sword.ItemType.ToString(), Price = sword.Price, Attack = sword.Attack, Part = part }; currentUser.Hero.Inventory.Items.Add(attackItem); break; case "Helmet": var helmet = new Helmet { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var defenceItem = new DefenceItem { ItemType = helmet.ItemType.ToString(), Price = helmet.Price, Defence = helmet.Defence, Part = part }; currentUser.Hero.Inventory.Items.Add(defenceItem); break; } } else { switch (part) { case "Belt": var belt = new Belt { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var beltItem = new DefenceAttack { ItemType = belt.ItemType.ToString(), Price = belt.Price, Defence = belt.Defence, Attack = belt.Attack, Part = part }; currentUser.Hero.Inventory.Items.Add(beltItem); break; case "Boots": var boots = new Boots { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var bootsItem = new DefenceAttack { ItemType = boots.ItemType.ToString(), Price = boots.Price, Defence = boots.Defence, Attack = boots.Attack, Part = part }; currentUser.Hero.Inventory.Items.Add(bootsItem); break; case "Chest": var chest = new Chest { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var chestItem = new DefenceAttack { ItemType = chest.ItemType.ToString(), Price = chest.Price, Defence = chest.Defence, Attack = chest.Attack, Part = part }; currentUser.Hero.Inventory.Items.Add(chestItem); break; case "Pants": var pants = new Pants { ItemType = (ItemType)Enum.Parse(typeof(ItemType), type, true) }; var pantsItem = new DefenceAttack { ItemType = pants.ItemType.ToString(), Price = pants.Price, Defence = pants.Defence, Attack = pants.Attack, Part = part }; currentUser.Hero.Inventory.Items.Add(pantsItem); break; } } unitOfWork.Commit(); }
public virtual void GetSkillDamage01(AttackItem attack, DefAction OnFinish = null) { ShowBloodAndSound(); }
public virtual void GetSkillDamage02(AttackItem attack, DefAction OnFinish = null) { //Damage Effect ReleaseREffect(holyFireEffect, holyFirePos); }
public void freeAttackItem(AttackItem attackItem) { ObjectPoolManager.Destroy(attackItem.gameObject); }
protected virtual void GetAttack01Damage(AttackItem attack, DefAction OnFinish = null) { //Move Posotion AttackMoveBack(attack.JumpHeight, attack.JumpHeight); }
public virtual void GetSkillDamage03(AttackItem attack, DefAction OnFinish = null) { ShowBloodAndSound(); AttackMoveBack(attack.JumpHeight, attack.JumpHeight); }
public void CalDamage(AttackItem attack) { this.Hp = this.Hp - (int)attack.Damage; }