Ejemplo n.º 1
0
 public AttackCollider(World world, Dictionary <string, string> stats, Vector2 pos, Dimensions dims, long lifetime) :
     base(world, Sprite.None)
 {
     this.startTime = world.gameTime.TotalGameTime.Ticks;
     this.lifetime  = lifetime;
     attackStats    = new StatBlock(stats);
     Pos            = pos;
     Dims           = dims;
 }
Ejemplo n.º 2
0
 public ShellyEnemy(World world, Vector2 patrolPt1, Vector2 patrolPt2) :
     base(world, new Sprite(Images.GetImage("shelly_enemy"), 32, 32, Consts.PlayerAnimFrameLength))
 {
     Stats.Set("s_team", "evil");
     this.patrolPts = new Vector2[2];
     patrolPts[0]   = patrolPt1;
     patrolPts[1]   = patrolPt2;
     Dims           = new Dimensions(32, 32);
     attackStats    = new StatBlock(new Dictionary <string, string> {
         { "s_team", "good" },
         { "n_phy_dmg", "5.0" }
     });
 }
Ejemplo n.º 3
0
 void AddTo(StatBlock other)
 {
     foreach (var stat in other.stats)
     {
         if (stat.Key[0] == 'n')
         {
             stats[stat.Key] += Convert.ToSingle(stat.Value);
         }
         else if (stat.Key[0] == 'b')
         {
             stats[stat.Key] = Convert.ToString(Convert.ToBoolean(stat.Value) || Convert.ToBoolean(stats[stat.Key]));
         }
     }
 }
Ejemplo n.º 4
0
 public void DoDamage(StatBlock damageStats)
 {
     Console.WriteLine(this.GetType().Name + Stats.Get("n_health") + Stats.Get("s_team") + damageStats.Get("s_team"));
     // NOTE: Make it so this is easier to do,with fewer Converts
     if (damageStats.Get("s_team").CompareTo(Stats.Get("s_team")) == 0)
     {
         Stats.Set("n_health", Convert.ToString(Convert.ToSingle(Stats.Get("n_health"))
                                                - Convert.ToSingle(damageStats.Get("n_phy_dmg"))
                                                * (1.0 / Convert.ToSingle(Stats.Get("n_phy_def")))));
     }
     if (Convert.ToSingle(Stats.Get("n_health")) < 0.0)
     {
         SpriteSheet.FlashSprite(5);
         Kill();
     }
 }
Ejemplo n.º 5
0
        public Entity(World world, Sprite sprite)
        {
            this.world     = world;
            SpriteSheet    = sprite;
            GravityAccn    = 0.0F;
            GravityPaused  = false;
            Drag           = 0.9f;
            IsInteractable = false;

            Pos  = new Vector2(0f, 0f);
            Vel  = new Vector2(0f, 0f);
            Dims = new Dimensions(0, 0);

            SpriteOffset = new Point();
            Alive        = true;

            Stats = new StatBlock(new Dictionary <string, string> {
                { "s_team", "neutral" },
                { "n_health", "1.0" },
                { "n_total_health", "1.0" },
                { "n_phy_def", "1.0" }
            });
        }