public void SetSword(ISword sword) { currentSword = sword; swordSprite.sprite = currentSword.Sprite; _damageAreaDamageSystem.Damage = sword.Damage; var points = _damageAreaCollider.points; points[1] = new Vector2(0f, sword.MainDistance); points[0] = new Vector2( points[0].x, sword.MainDistance * 0.9f ); points[2] = new Vector2( points[2].x, sword.MainDistance * 0.9f ); points[3] = new Vector2( points[3].x, sword.MainDistance * 0.8f ); points[5] = new Vector2( points[5].x, sword.MainDistance * 0.8f ); }
/// <summary> /// Equips target armor /// </summary> /// <devnote> /// Custom equipment setter. /// Created to have more control on what's going on. /// </devnote> public void EquipWeapon(ISword sword, bool unequip = false) { if (!unequip) { Sword = sword; } else if (Sword?.Name == sword.Name) { Sword = default; } }
public IWeapon GetWeapon(WeaponsListEnum weapon) { switch (weapon) { case WeaponsListEnum.Sword: sword = sword ?? ContainerConfig.GetInstance <ISword>(); return((IWeapon)sword); case WeaponsListEnum.Mace: mace = mace ?? ContainerConfig.GetInstance <IMace>(); return(mace); case WeaponsListEnum.Bow: bowAndArrow = bowAndArrow ?? ContainerConfig.GetInstance <IBowAndArrow>(); return(bowAndArrow); } return(null); }
static void Main(string[] args) { ISword Sword = Generator.Sword(); IShield Shield = Generator.Shield(); //Constructor DI Warrior warrior = Generator.MakeWarrior(Sword, Shield); Preparation p = Generator.MakePreperations(); p.BattlePreperation(); IDragon dragon = Generator.MakeDragon(p.dragonType); IBattle Battle = Generator.Battle(p.sword, p.shield); Battle.Clash(warrior, dragon); Battle.BattleOutcome(warrior, dragon); Console.ReadKey(); }
public static Warrior MakeWarrior(ISword sword, IShield shield) { return(new Warrior(100, sword, shield)); }
//Constructor DI public Warrior(int health, ISword sword, IShield shield) { this.health = health; _sword = sword; _shield = shield; }
public void EquipWeapon(ISword sword) { _sword = sword; }
public Ninja(ISword sword, IShuriken shuriken) { this.Sword = sword; this.Shuriken = shuriken; }
public static void NewSword(ISword sword) { Console.WriteLine("You have found a new sword: {0} with {1} damage and special attack: {2}. ", sword.Name, sword.Damage, sword.AttackName); }
public SwordCollisionHandler(ISword sword, float colliderWidth, float colliderHeight, float offsetX, float offsetY) { this.sword = sword; Collider = new BoxCollider(sword, colliderWidth, colliderHeight, offsetX, offsetY); }