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
            );
    }
예제 #2
0
 /// <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;
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
        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();
        }
예제 #5
0
 public static Warrior MakeWarrior(ISword sword, IShield shield)
 {
     return(new Warrior(100, sword, shield));
 }
예제 #6
0
 //Constructor DI
 public Warrior(int health, ISword sword, IShield shield)
 {
     this.health = health;
     _sword      = sword;
     _shield     = shield;
 }
예제 #7
0
 public void EquipWeapon(ISword sword)
 {
     _sword = sword;
 }
예제 #8
0
 public Ninja(ISword sword, IShuriken shuriken) {
     this.Sword = sword;
     this.Shuriken = shuriken;
 }
예제 #9
0
 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);
 }