public Grenade(Unit owner)
     : base(owner)
 {
     animation = new Animation(GameManager.TheGameManager.Content.Load<Texture2D>(Path.Textures.Projectiles + "attacksprites"), Constants.DefaultFrameTime, true);
     animation.addFrame(new Rectangle(0, 0, 16, 16));
     Cast(owner);
 }
        public Ability(Unit owner)
        {
            this.Actors = GameManager.TheGameManager.Lists.Actors;

            this.Owner = owner;
            this.Invulnerable = true;
        }
示例#3
0
        public Aura(Unit owningUnit, int Power, float Duration)
        {
            this.Power = Power;
            this.Duration = Duration;

            this.owningUnit = owningUnit;
        }
        public BulletSpiral(Unit owner)
            : base(owner)
        {
            animation = new Animation(GameManager.TheGameManager.Content.Load<Texture2D>(Path.Textures.Projectiles + "plasmashot"), Constants.DefaultFrameTime, false);
            animation.addFrame(new Rectangle(0, 0, 32, 32));

            Cast(owner);
        }
        public static Ability Cast(Unit caster, Texture2D texture, Queue<Vector2> shotAngles, float delay)
        {
            Ability ability = new RangedAttack(caster, texture, shotAngles, delay);
            caster.SetCooldown(AbilityID.RangedAttack, ability.Cooldown);

            GameManager.TheGameManager.Lists.AddOnNextFrameList.Add(ability);
            return ability;
        }
示例#6
0
        public override void DeliverPayload(Unit hit_unit)
        {
            hit_unit.Affect(UnitOwner, "fire", 10);
            hit_unit.ApplyAura(new Ignite(UnitOwner, 5, 5000));
            DeleteAndCleanup();

            base.DeliverPayload(hit_unit);
        }
 public void Cast(Unit unit)
 {
     // TODO - charge up
     if (GameManager.TheGameManager.ControlledUnit != null)
     {
         target = GameManager.TheGameManager.ControlledUnit.Position;
     }
 }
示例#8
0
        public StatusText(Unit owner, StatusType type, string text)
        {
            font = GameManager.TheGameManager.defaultFont;

            this.type = type;
            this.text = text;
            this.owner = owner;
            this.Position = owner.Center;
        }
示例#9
0
        public override void DeliverPayload(Unit hit_unit)
        {
            if (!hit)
            {
                hit = true;
                chainedUnit = hit_unit;
                chainNumber = actors.Count - 1;
            }

            base.DeliverPayload(hit_unit);
        }
        public void Cast(Unit unit)
        {
            Actor actor = new Actor(this);
            actor.Animation = animation;
            actor.Position = Owner.Center;
            actor.Velocity = new Vector2(18 * (int)Owner.direction, 0);
            actor.SpriteEffect = Owner.direction == FaceDirection.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            actor.Scale = 2f;

            actor.sprite.PlayAnimation(animation);
            Actors.Add(actor);
        }
        public SlimeAbility(Unit owner)
            : base(owner)
        {
            animation = new Animation(GameManager.TheGameManager.Content.Load<Texture2D>(Path.Textures.Units + "slime"), Constants.DefaultFrameTime, true);
            animation.addFrame(new Rectangle(0, 0, 32, 32));

            Cooldown = 3000f;
            Owner.DelayTimer = 9999f;

            originalScale = Owner.Scale;
            Cast(owner);
        }
        public ChargeStrike(Unit owner)
            : base(owner)
        {
            //animation = new Animation(GameManager.TheGameManager.Content.Load<Texture2D>("fx/plasmashot_red"), Constants.DefaultFrameTime, false);
            //animation.addFrame(new Rectangle(0, 0, 32, 32));
            //sprite.PlayAnimation(animation);

            Cooldown = 3000f;

            this.caster = owner;
            Cast(owner);
        }
        public RangedAttack(Unit owner, Texture2D texture, Queue<Vector2> shotAngles, float delay)
            : base(owner)
        {
            animation = new Animation(texture, Constants.DefaultFrameTime, true);
            animation.addFrame(new Rectangle(0, 0, 32, 32));

            while (shotAngles.Count != 0) {
                Vector2 shotAngle = shotAngles.Dequeue();
                Fire(owner, shotAngle);
            }

            Cooldown = 400f;
        }
        public void Fire(Unit unit, Vector2 angle)
        {
            Actor actor = new Actor(this);
            actor.Animation = animation;
            actor.Position = Owner.Center + new Vector2(18 * (int)Owner.direction, 12);
            actor.Velocity = new Vector2(16 * (int)Owner.direction, 0);
            actor.SpriteEffect = Owner.direction == FaceDirection.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            actor.Scale = 1.2f;
            actor.Team = Owner.Team;
            actor.Invulnerable = true;

            actor.sprite.PlayAnimation(animation);
            Actors.Add(actor);
        }
        public void Cast(Unit unit)
        {
            for (int i = 0; i < 360; i += 12)
            {
                Actor actor = new Actor(this);
                actor.Animation = animation;
                actor.Position = Owner.Center;
                actor.Velocity = new Vector2(
                    (float)Math.Cos(MathHelper.ToRadians(i)) * 9,
                    (float)Math.Sin(MathHelper.ToRadians(i)) * 9);

                actor.Rotation = (float)Math.Atan2(actor.Velocity.Y , actor.Velocity.X) + MathHelper.ToRadians(90);
                actor.sprite.PlayAnimation(animation);
                Actors.Add(actor);
            }
        }
示例#16
0
        public static Unit LoadUnit(string unit_name)
        {
            ContentManager content = GameManager.TheGameManager.Content;

            if (content == null) return null;

            try
            {
                UnitContent unitContent = content.Load<UnitContent>(Constants.Path.Unit + unit_name);
                Unit newUnit = new Unit(unitContent);

                return newUnit;
            }

            catch (ContentLoadException cle)
            {
                Debug.Assert(false, cle.Message);
                return null;
            }
        }
        public void Cast(Unit unit)
        {
            Actor actor = new Actor(this);
            actor.Animation = animation;
            actor.Position = Owner.Center + new Vector2(18 * (int)Owner.direction, 12);
            actor.Floating = false;
            actor.Velocity = new Vector2(6* (int)Owner.direction, -16);
            actor.SpriteEffect = Owner.direction == FaceDirection.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            actor.Scale = 0.3f;
            actor.Team = Owner.Team;
            actor.Invulnerable = true;

            timer = delay;

            Owner.Scale -= 0.334f;

            if (Owner.Scale <= 0.0f)
                Owner.Scale = 0.0f;

            actor.sprite.PlayAnimation(animation);
            Actors.Add(actor);
        }
示例#18
0
        public void RequestOrder(Unit unit)
        {
            if (unit.AIData.Stance == UnitAIData.StanceType.AttackOnSight)
            {
                Unit target_unit = GameManager.TheGameManager.FindTarget(unit);
                if (target_unit != null)
                    unit.AIData.AttackOrder(target_unit);
            }

            if (unit.AIData.Stance == UnitAIData.StanceType.Wander)
            {
                Random random = new Random();
                int x = random.Next(-2, 3);
                int y = random.Next(-2, 3);

                Vector2 tileCoord = GameManager.TheGameManager.Map.PositionToTileCoord(unit.Position) + new Vector2(x, y);

                if (!GameManager.TheGameManager.Map.isObstructedByMap(Tilemap.Map.LookupType.Tile, tileCoord))
                {
                    unit.AIData.MoveOrder(tileCoord);
                }
            }
        }
示例#19
0
 public CrimsonFulgur(Unit owner, AbilityContent abilityContent)
     : base(owner, abilityContent)
 {
     sa = new SingleAnimation(abilityContent.AbilityTexture, 1);
 }
示例#20
0
        // Move into global
        public Actor(Ability ability, SingleAnimation animation, Vector2 position)
        {
            this.unitOwner = ability.UnitOwner;
            this.abilityOwner = ability;

            this.animation = animation;
            this.position = position;
        }
示例#21
0
 private void DeleteAndCleanup(Unit unit)
 {
     GameManager.TheGameManager.DeleteAndCleanup(this);
 }
示例#22
0
 /// <summary>
 /// Triggered when this units kills another with a ability it owns.
 /// </summary>
 /// <param name="unit"></param>
 public void KilledA(Unit unit)
 {
     // FIXME - Placeholder for experience.
     string experienceGainText = "+" + "50" + " XP";
     StatusText statusText = new StatusText(this, StatusText.StatusType.Damage, experienceGainText);
     statusTextList.Add(statusText);
 }
示例#23
0
        /// <summary>
        /// Kill the unit.
        /// </summary>
        /// <param name="creditedUnit"></param>
        public void Kill(Unit creditedUnit)
        {
            if (creditedUnit != null)
                creditedUnit.KilledA(this);

            GameManager.TheGameManager.NotifyScenario(Scenario.Event.onUnitDeath, tag);
            DeleteAndCleanup(this);
        }
示例#24
0
        public void Affect(Unit originatingUnit, string type, int amount)
        {
            CurrentHealth -= amount;

            // Play white flash effect
            UnitEffect hitEffect = new UnitEffect(this, "ForceWhite", UnitEffect.EffectType.Flashing);
            hitEffect.Activate();
            unitEffectList.Add(hitEffect);

            // Handle damage.
            if (amount > 0)
            {
                StatusText statusText = new StatusText(this, StatusText.StatusType.Damage, amount.ToString());
                statusTextList.Add(statusText);
                lastHitBy = originatingUnit;
            }
        }
示例#25
0
        /// <summary>
        /// Find a target for the asking unit - does not take any criteria into account currently, just attack the first thing you see!
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public Unit FindTarget(Unit seeking_unit, int range)
        {
            foreach (GameObject gameObject in GameManager.TheGameManager.GameObjects)
            {
                if (gameObject.GetType() != typeof(Unit)
                    || gameObject != seeking_unit)
                {
                    continue;
                }

                //if () continue;
                if (Vector2.Distance(seeking_unit.Position, gameObject.Position) > range) continue;

                return (Unit)gameObject;
            }
            return null;
        }
示例#26
0
 public Ability(Unit owner, AbilityContent abilityContent)
 {
     this.abilityContent = abilityContent;
     this.actors = new List<Actor>();
     this.unitOwner = owner;
 }
 public UnitEffect(Unit owner, string effect_name, EffectType effect_type)
 {
     this.effectName = effect_name;
     this.effectType = effect_type;
     this.owner = owner;
 }
示例#28
0
 public virtual void DeliverPayload(Unit hit_unit)
 {
 }
示例#29
0
 public void AttachToUnit(Unit unit)
 {
     this.attachedUnit = unit;
 }
        private void Attack(Unit unit2)
        {
            Random random = new Random();
            int r = random.Next(2);

            switch(r) {
                case 0: AbilityFactory.Create(AbilityID.BulletSpiral, this); break;
                case 1: AbilityFactory.Create(AbilityID.BulletCross, this); break;
            }
        }