コード例 #1
0
        public override Projectile spawnProjectile()
        {
            int damage = king ? (int)(hitDamage * 1.5f) : hitDamage;

            weaponCooldown      = 8;
            weaponReadyToAction = false;

            int   shiftX        = 0;
            float chargePercent = weaponCharge / (float)weaponChargeLimit;

            if (face == 1)
            {
                shiftX = 30;
            }
            else
            {
                shiftX = -1;
            }

            Projectile pr = new SwordSlash(X + shiftX * 2, Y + 5, face, 6 + (int)(damage * chargePercent), Team, ID, 3);

            weaponCharge = 0;

            return(pr);
        }
コード例 #2
0
 public void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
コード例 #3
0
 public Warrior()
 {
     hpBar = new HealthBar(this);
     tag   = "Player";
     animation.spriteArray = ContentCollection.warrior;
     spriteSize            = new Vector2(35, 80);
     gamePosition          = new Vector2(200, 350);
     movementSpeed         = 150;
     maxHealth             = 100;
     currentHealth         = maxHealth;
     healthRegen           = 1;
     damage          = 50;
     primaryAttack   = new SwordSlash(this);
     secondaryAttack = new Rage(this);
     attackSpeed     = 1;
     secondaryCD     = 10;
     StartThread();
 }
コード例 #4
0
        // this factory produces skills from BasicWeaponMoves directory
        // note: since every skill in BasicWeaponMoves is meant for a different weapon, we don't use any combos or decorators here
        public Skill CreateSkill(Player player)
        {
            List <Skill> playerSkills = player.ListOfSkills;
            List <Skill> tmp          = new List <Skill>();
            List <Skill> drawn        = new List <Skill>();
            SpearStab    s1           = new SpearStab();
            SwordSlash   s2           = new SwordSlash();
            AxeCut       s3           = new AxeCut();

            if (s1.MinimumLevel <= player.Level)
            {
                tmp.Add(s1);                                  // check level requirements
            }
            if (s2.MinimumLevel <= player.Level)
            {
                tmp.Add(s2);
            }
            if (s3.MinimumLevel <= player.Level)
            {
                tmp.Add(s3);
            }

            foreach (Skill skill in playerSkills) // don't offer skills which the player knows already
            {
                if (skill is SpearStab)
                {
                    tmp.Remove(s1);
                }
                if (skill is SwordSlash)
                {
                    tmp.Remove(s2);
                }
                if (skill is AxeCut)
                {
                    tmp.Remove(s3);
                }
            }
            if (tmp.Count == 0)
            {
                return(null);
            }
            return(tmp[Index.RNG(0, tmp.Count)]);
        }
コード例 #5
0
    private void AddUnitHit(Unit unit)
    {
        SwordSlash parentAction = (SwordSlash)action;

        parentAction.victims.Add(unit);
    }
コード例 #6
0
    private bool IsAlreadyHit(Unit unit)
    {
        SwordSlash parentAction = (SwordSlash)action;

        return(parentAction.victims.Contains(unit));
    }
コード例 #7
0
ファイル: Warrior.cs プロジェクト: Trainian/MyMiniGame
 public Warrior(string name) : base(name)
 {
     Ability = new SwordSlash();
 }
コード例 #8
0
        public override Actor createActor(int id, Vector2 position, Microsoft.Xna.Framework.Vector2?velocity = null, double color = -1)
        {
            Actor a = null;

            if ((position.X >= 0 && position.X < world.width * Tile.size && position.Y >= 0 && position.Y < world.height * Tile.size))
            {
                switch (id)
                {
                case 0:
                    a = new Player(world, position);
                    return(a);

                case 1:
                    a = new Octo(world, position);
                    break;

                case 2:
                    a = new Blob(world, position, velocity ?? Vector2.Zero, color);
                    break;

                case 3:
                    a = new Sentinel(world, position);
                    break;

                case 4:
                    a = new Spikon(world, position);
                    break;

                case 5:
                    a = new Arrow(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 6:
                    a = new OctoBall(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 7:
                    a = new HealthOrb(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 8:
                    a = new FireShuriken(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 9:
                    a = new IceSpike(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 10:
                    a = new Numbers(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 11:
                    a = new FirstBoss(world, position);
                    return(a);

                case 12:
                    a = new LevelUp(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 13:
                    a = new Laser(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 14:
                    a = new FirePillar(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 15:
                    a = new ManaOrb(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 16:
                    a = new Zazzle(world, position);
                    return(a);

                case 17:
                    a = new ZazzleShot(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 18:
                    a = new Basilisk(world, position);
                    return(a);

                case 19:
                    a = new BlobSpawner(world, position);
                    return(a);

                case 20:
                    a = new Charger(world, position);
                    return(a);

                case 21:
                    a = new Grapple(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 22:
                    a = new Generator(world, position);
                    return(a);

                case 23:
                    a = new Explosion(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 24:
                    a = new Torch(world, position);
                    return(a);

                case 25:
                    a = new MagicPrimary(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 26:
                    a = new WizBlob(world, position);
                    return(a);

                case 27:
                    a = new LaserArrow(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 28:
                    a = new DiscoBlob(world, position, velocity ?? Vector2.Zero, color, checkpointCount++);
                    break;

                case 29:
                    a = new FireBlob(world, position, velocity ?? Vector2.Zero);
                    break;

                case 30:
                    a = new MrHammer(world, position, velocity ?? Vector2.Zero);
                    break;

                case 31:
                    a = new GigaBlob(world, position, velocity ?? Vector2.Zero);
                    break;

                case 32:
                    a = new MagicPrimary(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 33:
                    a = new DarkLucyPortrait(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 34:
                    a = new BloodyArrow(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 35:
                    a = new LucyFirePillar(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 36:
                    a = new WeddingPhoto(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 37:
                    a = new FancyPortrait(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 38:
                    a = new CoatOfArms(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 39:
                    a = new TandemBike(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 40:
                    a = new KnightStatue(world, position, velocity ?? Vector2.Zero);
                    return(a);

                case 41:
                    a = new SwordSlash(world, position, velocity ?? Vector2.Zero);
                    return(a);
                }
            }

            return(a);
        }