示例#1
0
 public virtual void Update(List <Unite> unitsOnMap, List <Effet> effets)
 {
     Animer();
     PositionTile = new Vector2((int)(ConvertUnits.ToDisplayUnits(body.Position.X) / 32), (int)(ConvertUnits.ToDisplayUnits(body.Position.Y) / 32));
 }
示例#2
0
        bool body_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            Unite objet1 = (Unite)(fixtureA.Body.UserData);

            if (objet1.isAChamp)
            {
                if (objet1.ObjectifListe.Count > 0)
                {
                    Vector2      position = new Vector2((int)(ConvertUnits.ToDisplayUnits(objet1.body.Position.X) / 32), (int)(ConvertUnits.ToDisplayUnits(objet1.body.Position.Y) / 32));
                    List <Noeud> chemin   = PathFinding.TrouverChemin(position, objet1.ObjectifListe[objet1.ObjectifListe.Count - 1].Position, Map.Taille, Map.unites, Map.unitesStatic, false);
                    if (chemin != null)
                    {
                        objet1.ObjectifListe = chemin;
                    }
                }
            }

            return(true);
        }
示例#3
0
 public virtual void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(Sprite, ConvertUnits.ToDisplayUnits(body.Position), SpritePosition, Color.White, 0f, new Vector2(Tiles.X / 2, Tiles.Y / 2), Scale, FlipH ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
 }
示例#4
0
 public void CreateBody(int echelle, Vector2 Position)
 {
     this.body              = BodyFactory.CreateRectangle(Map.world, ConvertUnits.ToSimUnits(25 * echelle), ConvertUnits.ToSimUnits(25 * echelle), 100f);
     this.body.Position     = ConvertUnits.ToSimUnits(Position * Map.TailleTiles + new Vector2(16, 16));
     this.body.IsStatic     = false;
     this.body.OnCollision += new OnCollisionEventHandler(body_OnCollision);
     this.body.UserData     = this;
     this.body.Mass         = 100;
     this.PositionTile      = Position;
 }
示例#5
0
 public static float DistanceUnites(Objet unite1, Objet unite2)
 {
     return((float)Math.Sqrt(Math.Pow(ConvertUnits.ToDisplayUnits(unite1.body.Position - unite2.body.Position).X, 2) + Math.Pow(ConvertUnits.ToDisplayUnits(unite1.body.Position - unite2.body.Position).Y, 2)));
 }