예제 #1
0
파일: Monster.cs 프로젝트: jafework/CS461
 public Monster(MonsterStatus stats, Sprite sprite, SpriteManager sm)
 {
     this.stats         = stats;
     this.sprite        = sprite;
     this.SM            = sm;
     currenttask        = new Task(Task.Type.Poop, null);
     currenttask.status = Task.Status.Done;
 }
예제 #2
0
 public Monster(MonsterStatus stats, Sprite sprite, SpriteManager sm)
 {
     this.stats = stats;
     this.sprite = sprite;
     this.SM = sm;
     currenttask = new Task(Task.Type.Poop, null);
     currenttask.status = Task.Status.Done;
 }
예제 #3
0
        private void Initilize()
        {
            spritebatch   = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List <Vector2> path = pathfinder.FindPath(new Point(1, 1), new Point(10, 1));

            foreach (Vector2 point in path)
            {
                //Console.WriteLine("Path: " + point);
            }

            foreach (Vector2 point in path)
            {
                AIPos = new Vector2(point.X, point.Y);
                //Console.WriteLine("AI: " + AIPos);
                break;
            }

            /*
             * foreach (Vector2 point in tempPath)
             * {
             *  AIPos = new Vector2((point.X / 48) % 16, (point.Y / 48) % 16);
             *  Console.WriteLine("AI: " + AIPos);
             *  break;
             * }
             *
             * foreach (Vector2 point in tempPath)
             * {
             *  int pointX = (int)point.X;
             *  int pointY = (int)point.Y;
             *  int tempX, tempY;
             *
             *  if (((point.X % 48) != 0) || (((point.Y % 48) != 0)))
             *  {
             *      tempX = (int)(point.X % 48);
             *      tempY = (int)(point.Y % 48);
             *
             *      Console.WriteLine("point = {X:" + pointX + " Y:" + pointY + "} X = " + tempX + " Y = " + tempY);
             *
             *      if (tempX == 32)
             *          pointX += 16;
             *
             *      if (tempX == 16)
             *          pointX -= 16;
             *
             *      if (tempY == 32)
             *          pointY += 16;
             *
             *      if (tempY == 16)
             *          pointY -= 16;
             *
             *      path.Add(new Vector2(pointX, pointY));
             *  }
             * }
             */

            Human h1 = new Human(
                contentManager.Load <Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(48, 48),
                Vector2.Zero,
                10, 0, movedata, sceneManager);

            spriteManager.AddSprite(h1);
            Console.WriteLine("TESSSSSSSSSST");
            MonsterStatus ms = new MonsterStatus(0, 0, 0, @"Monster One");

            M1 = new Monster(ms, ref h1, spriteManager);

            spriteManager.AddSprite(new ComputerAI(
                                        contentManager.Load <Texture2D>(@"Sprites/player"),
                                        new Point(42, 42),
                                        AIPos,
                                        Vector2.Zero,
                                        10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            line = new Texture2D(_graphicsDevice, 1, 1);
            line.SetData(new[] { Color.Black });
        }
예제 #4
0
        private void Initilize()
        {
            spritebatch = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List<Vector2> path = pathfinder.FindPath(new Point(1, 1), new Point(10, 1));

            foreach (Vector2 point in path)
            {
                //Console.WriteLine("Path: " + point);
            }

            foreach (Vector2 point in path)
            {
                AIPos = new Vector2(point.X, point.Y);
                //Console.WriteLine("AI: " + AIPos);
                break;
            }

            /*
            foreach (Vector2 point in tempPath)
            {
                AIPos = new Vector2((point.X / 48) % 16, (point.Y / 48) % 16);
                Console.WriteLine("AI: " + AIPos);
                break;
            }

            foreach (Vector2 point in tempPath)
            {
                int pointX = (int)point.X;
                int pointY = (int)point.Y;
                int tempX, tempY;

                if (((point.X % 48) != 0) || (((point.Y % 48) != 0)))
                {
                    tempX = (int)(point.X % 48);
                    tempY = (int)(point.Y % 48);

                    Console.WriteLine("point = {X:" + pointX + " Y:" + pointY + "} X = " + tempX + " Y = " + tempY);

                    if (tempX == 32)
                        pointX += 16;

                    if (tempX == 16)
                        pointX -= 16;

                    if (tempY == 32)
                        pointY += 16;

                    if (tempY == 16)
                        pointY -= 16;

                    path.Add(new Vector2(pointX, pointY));
                }
            }
            */

            Human h1 = new Human(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(48, 48),
                Vector2.Zero,
                10, 0, movedata, sceneManager);
            spriteManager.AddSprite(h1);
            Console.WriteLine("TESSSSSSSSSST");
            MonsterStatus ms = new MonsterStatus(0, 0, 0, @"Monster One");
            M1 = new Monster(ms, ref h1, spriteManager);

            spriteManager.AddSprite(new ComputerAI(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                AIPos,
                Vector2.Zero,
                10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            line = new Texture2D(_graphicsDevice, 1, 1);
            line.SetData(new[] { Color.Black });
        }