예제 #1
0
        public WorldEffect(GameScreen game, Texture2D effect, Entity entity, Vector2 delta, int lifeSpan, int frameX, int frameY)
        {
            this.effect = effect;
            LifeSpan = lifeSpan;

            InitEffect(effect, frameX, frameY);

            BindTo(entity, delta);

            Game = game;
            Game.WorldEffects.Add(this);
        }
예제 #2
0
파일: Monster.cs 프로젝트: wiilinkpds/Wotrn
        public void Damage(Entity source, int life)
        {
            Life -= life;
            if (Life <= 0)
            {
                if (source is Player)
                {
                    ((Player) source).GainXp(xp);
                    ((Player) source).Stats.AmountKilled++;
                }

                Delete(); // Appelle la fonction Delete() qui supprime le Monster et envoie ce dernier dans la liste deletedEntities
                if (Targeter != null && ReferenceEquals(Targeter.Target, this)) // Si Game.Player.Target == Ce Monster (celui qui vient d'etre detruit) alors le joueur n'a plus de cible
                    Targeter.Target = null;
            }
        }
예제 #3
0
        public Pathfinding(GameTime gameTime, Vector2 player, Entity monster, MapData map)
        {
            this.monster = monster;

            openedList = new List<Node>();
            closedList = new List<Node>();
            mapData = map;

            if (player.X < 0 || player.X > mapData.MapWidth * 32 || player.Y < 0 || player.Y > mapData.MapHeight * 32 || mapData.Accessibility[ConversionManager.VectToId(map, player)] == 1)
                return;

            start = new Node(monster.Position, monster.Position, player, mapData) { Parent = null };
            arrival = new Node(player, monster.Position, player, mapData);

            openedList.Add(start);
            PathFind(gameTime, map);
        }
예제 #4
0
 public void BindTo(Entity entity, Vector2 delta)
 {
     entityBind = entity;
     entityDelta = delta;
 }
예제 #5
0
        public void Movement(GameTime gameTime, Entity entitie, MapData map)
        {
            int id = (int)(entitie.Position.X / 32) + (int)(entitie.Position.Y / 32) * mapData.MapWidth;
            float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 10.0f;
            move = Vector2.Zero;

            if (list != null)
                list.Remove(id);

            if (list != null && list.Count > 0)
            {
                if (list[list.Count - 1] == id - mapData.MapWidth)
                {
                    if (gameTime.TotalGameTime.TotalMilliseconds % 500 < 10 || !(entitie is Monster))
                        entitie.Direction = Direction.Up;
                    move.Y--;
                    move.Normalize();
                    if (ConversionManager.VectToId(map, new Vector2(entitie.Position.X, entitie.Position.Y + entitie.TextureSize.Y + (move.Y * entitie.Speed * time))) == id - mapData.MapWidth)
                        list.Remove(id - mapData.MapWidth);
                }
                else if (list[list.Count - 1] == id + mapData.MapWidth)
                {
                    if (gameTime.TotalGameTime.TotalMilliseconds % 1000 < 10 || !(entitie is Monster))
                        entitie.Direction = Direction.Down;
                    move.Y++;
                    move.Normalize();
                    if (ConversionManager.VectToId(map, new Vector2(entitie.Position.X, entitie.Position.Y + (move.Y * entitie.Speed * time))) == id + mapData.MapWidth)
                        list.Remove(id + mapData.MapWidth);
                }
                else if (list[list.Count - 1] == id - 1)
                {
                    if (gameTime.TotalGameTime.TotalMilliseconds % 1000 < 10 || !(entitie is Monster))
                        entitie.Direction = Direction.Left;
                    move.X--;
                    move.Normalize();
                    if (ConversionManager.VectToId(map, new Vector2(entitie.Position.X + entitie.TextureSize.X + (move.X * entitie.Speed * time), entitie.Position.Y)) == id - 1)
                        list.Remove(id - 1);
                }
                else if (list[list.Count - 1] == id + 1)
                {
                    if (gameTime.TotalGameTime.TotalMilliseconds % 1000 < 10 || !(entitie is Monster))
                        entitie.Direction = Direction.Right;
                    move.X++;
                    move.Normalize();
                    if (ConversionManager.VectToId(map, new Vector2(entitie.Position.X + (move.X * entitie.Speed * time), entitie.Position.Y)) == id + 1)
                        list.Remove(id + 1);
                }
                if (move == Vector2.Zero)
                    return;

                entitie.Position = entitie.Position + move * entitie.Speed * time;
            }
        }
예제 #6
0
 public MegaBlast(Entity owner)
     : base(owner, TexturesManager.MegaBlast, SpellType.Cast, 1)
 {
 }
예제 #7
0
파일: SpeedUp.cs 프로젝트: wiilinkpds/Wotrn
 public SpeedUp(Entity owner)
     : base(owner, TexturesManager.SpeedUp, SpellType.Buff , 1)
 {
 }
예제 #8
0
 public AstralMove(Entity owner)
     : base(owner, TexturesManager.AstralMove,SpellType.Buff, 1)
 {
     position = owner.Position;
 }