コード例 #1
0
 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);
 }
コード例 #2
0
        public Ability(Unit owner)
        {
            this.Actors = GameManager.TheGameManager.Lists.Actors;

            this.Owner = owner;
            this.Invulnerable = true;
        }
コード例 #3
0
ファイル: Aura.cs プロジェクト: ndssia/Project-Corsair
        public Aura(Unit owningUnit, int Power, float Duration)
        {
            this.Power = Power;
            this.Duration = Duration;

            this.owningUnit = owningUnit;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #7
0
 public void Cast(Unit unit)
 {
     // TODO - charge up
     if (GameManager.TheGameManager.ControlledUnit != null)
     {
         target = GameManager.TheGameManager.ControlledUnit.Position;
     }
 }
コード例 #8
0
ファイル: StatusText.cs プロジェクト: ndssia/Project-Corsair
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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;
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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
ファイル: UnitContent.cs プロジェクト: ndssia/Project-Corsair
        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;
            }
        }
コード例 #17
0
        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
ファイル: AIManager.cs プロジェクト: ndssia/Project-Corsair
        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
ファイル: Ability.cs プロジェクト: ndssia/Project-Corsair
        // 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
ファイル: Unit.cs プロジェクト: ndssia/Project-Corsair
 private void DeleteAndCleanup(Unit unit)
 {
     GameManager.TheGameManager.DeleteAndCleanup(this);
 }
コード例 #22
0
ファイル: Unit.cs プロジェクト: ndssia/Project-Corsair
 /// <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
ファイル: Unit.cs プロジェクト: ndssia/Project-Corsair
        /// <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
ファイル: Unit.cs プロジェクト: ndssia/Project-Corsair
        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
ファイル: Ability.cs プロジェクト: ndssia/Project-Corsair
 public Ability(Unit owner, AbilityContent abilityContent)
 {
     this.abilityContent = abilityContent;
     this.actors = new List<Actor>();
     this.unitOwner = owner;
 }
コード例 #27
0
 public UnitEffect(Unit owner, string effect_name, EffectType effect_type)
 {
     this.effectName = effect_name;
     this.effectType = effect_type;
     this.owner = owner;
 }
コード例 #28
0
ファイル: Ability.cs プロジェクト: ndssia/Project-Corsair
 public virtual void DeliverPayload(Unit hit_unit)
 {
 }
コード例 #29
0
ファイル: Aura.cs プロジェクト: ndssia/Project-Corsair
 public void AttachToUnit(Unit unit)
 {
     this.attachedUnit = unit;
 }
コード例 #30
0
        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;
            }
        }