Пример #1
0
        public Wave(Dictionary <string, Texture2D> dicEnemytextures, int spawnpoint, ContentManager contentManager, Texture2D hpBar, MovementGrid grid, ObjectManager objMan, int graveId)
        {
            GraveId   = graveId;
            Id        = GraveId * 50;
            amountLst = new List <int>();

            HpBar           = hpBar;
            spawnPoint      = spawnpoint;
            spawnPointClone = spawnPoint;
            endPoint        = 0;
            dicTextures     = dicEnemytextures;
            objManager      = objMan;
            Grid            = grid;
            vecSpawnPoint   = new Vector2(Grid.SourceList[Grid.lstStart[spawnPoint]].X, Grid.SourceList[Grid.lstStart[spawnPoint]].Y);
            DelayTime       = 3000;
            ant             = 0;
            antFire         = 0;
            antIce          = 0;
            spider          = 0;
            spiderRegular   = 0;
            spiderLarge     = 0;
            werebear        = 0;
            werebearwhite   = 0;
            minotaur        = 0;
            bandit          = 0;
            banditLarge     = 0;
            banditRegular   = 0;
            goblinBlue      = 0;
            goblinBlack     = 0;
            goblinCyan      = 0;
            goblinGreen     = 0;
            goblinOrange    = 0;
            goblinPink      = 0;
            goblinPurple    = 0;
            goblinWhite     = 0;
            goblinYellow    = 0;

            base.Type = "Wave";
        }
Пример #2
0
        public Skeleton(Texture2D SkellySprite, int row, int columns, Vector2 SpawnPoint, int endPoint, int id, HeathBar hpBar, MovementGrid grid, string type)
        {
            Type        = "Skelly";
            IsEnemy     = true;
            EnemyId     = id;
            Moving      = true;
            expire      = false;
            obj_Expire += new EventHandler(Skeleton_obj_Expire);
            obj_Hit    += new EventHandler(Skeleton_obj_Hit);
            frame       = 0;
            Speed       = .5f;
            IsTarget    = false;
            HpBar       = hpBar;
            walkPath    = new Queue <int>();

            Position = SpawnPoint;
            Scale    = .6f;
            Rows     = row;
            Columns  = columns;
            setframes();
            Image    = SkellySprite;
            Velocity = Vector2.Zero;
            Name     = type;
            SetHp();
            SetDamage();
            CurrentHealth   = Health;
            animationTime   = 0;
            IsSpawn         = true;
            destRect        = new Rectangle((int)Position.X, (int)Position.Y, (int)((Image.Width / Columns) * Scale), (int)((Image.Height / Rows) * Scale));
            HpBar.BaseRect  = new Rectangle(destRect.X + destRect.Width / 2, destRect.Y + destRect.Height / 10, destRect.Width / 3, destRect.Height / 10);
            HpBar.MaxHealth = (int)Health;
            HpBar.Health    = (int)CurrentHealth;
            Origin          = new Vector2(destRect.X + destRect.Width / 2, destRect.Y + destRect.Height / 2);
            Grid            = grid;
            aSt             = new aStar(Grid);
            squareId        = getId();
            SourceList      = new List <Rectangle>();
            for (int i = 0; i < Rows; i++)
            {
                for (int x = 0; x < Columns; x++)
                {
                    SourceList.Add(new Rectangle(Image.Width / Columns * x, Image.Height / Rows * i, Image.Width / Columns, Image.Height / Rows));
                }
            }

            counter = 0;
            Visable = true;

            walkPath = aSt.FindPath(squareId, Grid.lstEnd[0], false);
            walkPath.Dequeue();
            NextPoint = Grid.SquareList[walkPath.Peek()].Origin;
            if (Grid.SourceList[squareId].Contains(new Point((int)NextPoint.X, (int)nextPoint.Y)))
            {
                walkPath.Dequeue();
                NextPoint = Grid.SquareList[walkPath.Peek()].Origin;
                checkDirection();
            }
            checkDirection();
            frameState = (int)ActionState.walk;
            selection  = walk[0, 0];
            selfacing  = facing();
            frame      = selection + selfacing * collums;
        }
Пример #3
0
        public Projectile(Texture2D image, int frames, Texture2D explosionImage, int explosionRows, int explosionColumns,
                          Vector2 start, int targetID, ObjectManager objman, MovementGrid grid, float speed, int damage, int typePro)
        {
            type     = typePro;
            Grid     = grid;
            aStar    = new EnemyEngine.aStar(Grid);
            Position = start;
            moving   = true;
            float scale = 0.8f;

            Speed               = speed;
            Damage              = damage;
            this.image          = image;
            this.explosionImage = explosionImage;
            ObjMan              = objman;
            Visable             = true;
            Frames              = frames;
            updateTarget(targetID);
            AnimationTime = 150;
            reverse       = false;
            Position      = start;
            destRect      = new Rectangle((int)Position.X, (int)Position.Y, (int)((image.Width / Frames) * scale), (int)((image.Height) * scale));
            Origin        = new Vector2(destRect.X + destRect.Width / 2, destRect.Y + destRect.Height / 2);
            TargetId      = targetID;
            sourceList    = new List <Rectangle> ();
            explosionList = new List <Rectangle> ();
            RotationTime  = 50;


            explosion      = false;
            Type           = "Projectile";
            facing         = 0;
            imageFrame     = 0;
            explosionFrame = 0;
            time           = 0;
            current        = 0;



            for (int i = 0; i < frames; i++)
            {
                sourceList.Add(new Rectangle(image.Width / frames * i, 0, image.Width / frames, image.Height));
            }
            if (type == 0)
            {
                for (int i = 0; i < explosionColumns; i++)
                {
                    for (int j = 0; j < explosionRows; j++)
                    {
                        explosionList.Add(new Rectangle(explosionImage.Width / explosionColumns * i, explosionImage.Height / explosionRows * j,
                                                        explosionImage.Width / explosionColumns, explosionImage.Height / explosionRows));
                    }
                }
            }
            else if (type == 1)
            {
                for (int j = 0; j < explosionRows; j++)
                {
                    for (int i = 0; i < explosionColumns; i++)
                    {
                        explosionList.Add(new Rectangle(explosionImage.Width / explosionColumns * i, explosionImage.Height / explosionRows * j,
                                                        explosionImage.Width / explosionColumns, explosionImage.Height / explosionRows));
                    }
                }
            }



            SquareId = getId();

            EndPosition = Grid.SquareList[SquareTarget].Origin;
            //EndPosition = Grid.SquareList[FirePath.Peek()].Origin;


            Rotation  = (float)Math.Atan2(EndPosition.Y - Position.Y, EndPosition.X - Position.X);
            RotOrigin = new Vector2(destRect.Width / 2, destRect.Height / 2);
            Velocity  = new Vector2((float)Math.Cos(Rotation) * Speed, (float)Math.Sin(Rotation) * Speed);
        }
Пример #4
0
 //bool pathFound;
 public aStar(MovementGrid grid)
 {
     Grid = grid;
 }