コード例 #1
0
ファイル: Imp.cs プロジェクト: Thegemsearcher/CoT5
 //public Imp(string texture, Vector2 position, Rectangle sourceRectangle, Vector2 depthSortingOffset, Player player, Grid grid, Map map, int hp, int attack, int defense) :
 //{
 //    attackSize = 500;
 //    aggroRange = 1200;
 //    speed = 160f;
 //    attacking = false;
 //    Color = Color.Red;
 //}
 public Imp(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, groundPositionOffset, depthSortingOffset, stats, map, grid, player)
 {
     attackRange = 500;
     aggroRange  = 600;
     speed       = 160f;
     isAttacking = false;
     Color       = Color.Red;
 }
コード例 #2
0
        public PhysicsObject(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed) : base(spritesheet, position)
        {
            Direction = direction;
            Speed     = speed;

            Direction = Vector2.Normalize(Direction);

            Console.WriteLine(Direction);
        }
コード例 #3
0
ファイル: Creature.cs プロジェクト: Thegemsearcher/CoT5
 public Creature(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, depthSortingOffset, true)
 {
     Stats  = stats;
     Map    = map;
     Grid   = grid;
     Player = player;
     this.groundPositionOffset = groundPositionOffset;
     attackHitbox   = new FloatRectangle(new Vector2(), new Vector2(attackRange, attackRange));
     GroundPosition = Position + Center + groundPositionOffset;
 }
コード例 #4
0
        public Enemy(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, groundPositionOffset, depthSortingOffset, stats, map, grid, player)
        {
            Scale      = 0.1f;
            LayerDepth = 0.2f;
            path       = new Position[0];

            //Det behövdes en offset för att attacken skulle bli lika stor åt alla håll.
            offsetAttackPosition = new Vector2(-spritesheet.SourceRectangle.Width * Scale / (float)4, -spritesheet.SourceRectangle.Height * Scale / (float)4);
            //Ska flyttas.
        }
コード例 #5
0
        public Particle(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed, float fadeSpeed, Color color, float rotation = 0, float scale = 1) :
            base(spritesheet, position, direction, speed)
        {
            FadeSpeed = fadeSpeed;
            Color     = color;
            Rotation  = rotation;
            Scale     = scale;

            LayerDepth = 1f;
        }
コード例 #6
0
ファイル: Equipment.cs プロジェクト: Thegemsearcher/CoT5
        public Equipment(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag, GearType gearType) : base(spritesheet, position, sourceRectangle, putInBag)
        {
            currentGearType      = gearType;
            verticalTileSlotSize = 1;
            texItem      = ResourceManager.Get <Texture2D>("rectangle");
            rectItemDrop = new Rectangle((int)position.X, (int)position.Y, 48, 48);

            switch (currentGearType)
            {
            case GearType.Sword:
                itemName        = "Wooden Sword";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 120, 24, 24);
                break;

            case GearType.Shield:
                itemName        = "Wooden Shield";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(240, 120, 24, 24);
                break;

            case GearType.Helmet:
                itemName        = "Wooden Helmet";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(240, 264, 24, 24);
                break;

            case GearType.Ring:
                itemName        = "Wooden Leggings";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 168, 24, 24);
                break;

            case GearType.Boots:
                itemName        = "Wooden Boots";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            case GearType.Bodyarmor:
                itemName        = "Wooden Bracers";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            case GearType.Gloves:
                itemName        = "Wool Bracers";
                itemDescription = "placeholder";
                //sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            default:
                break;
            }
        }
コード例 #7
0
        public GameObject(Spritesheet spritesheet, Vector2 position)
        {
            Spritesheet = spritesheet;
            Position    = position;

            Transparency = 1f;
            Scale        = 1f;
            IsActive     = true;

            Color  = Color.White;
            Hitbox = new FloatRectangle(Position, new Vector2(spritesheet.SourceRectangle.Width * Scale, spritesheet.SourceRectangle.Height * Scale));
            Center = new Vector2((float)spritesheet.SourceRectangle.Width / 2 * Scale, (float)spritesheet.SourceRectangle.Height / 2 * Scale);
        }
コード例 #8
0
ファイル: Item.cs プロジェクト: Thegemsearcher/CoT5
        public Item(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag) : base(spritesheet, position)
        {
            spritesheet.SetFrameCount(new Point(1, 1));
            spritesheet.Interval = 100;

            if (putInBag == true)
            {
                Pickup();
            }
            else
            {
                isInBag = false;
            }

            dragMode = false;
        }
コード例 #9
0
ファイル: Potion.cs プロジェクト: Thegemsearcher/CoT5
        public Potion(Spritesheet spritesheet, Vector2 position, Rectangle sourceRectangle, bool putInBag, PotionType potionType) : base(spritesheet, position, sourceRectangle, putInBag)
        {
            texItem = ResourceManager.Get <Texture2D>("potionSheet");
            verticalTileSlotSize = 1;
            currentPotionType    = potionType;
            rectItemDrop         = new Rectangle((int)position.X, (int)position.Y, 48, 48);

            switch (currentPotionType)
            {
            case PotionType.HealthSmall:
                itemName         = "Potion of Minor Health";
                itemDescription  = "Heals the player 20 points of health.";
                sourceRectSprite = new Rectangle(24, 120, 24, 24);
                break;

            case PotionType.HealthMedium:
                itemName         = "Potion of Moderate Health";
                itemDescription  = "Heals the player 40 points of health.";
                sourceRectSprite = new Rectangle(240, 120, 24, 24);
                break;

            case PotionType.HealthLarge:
                itemName         = "Potion of Potent Health";
                itemDescription  = "Heals the player 80 points of health.";
                sourceRectSprite = new Rectangle(240, 264, 24, 24);
                break;

            case PotionType.SpeedPotion:
                itemName         = "Potion of Swiftness";
                itemDescription  = "Grants the player 2x walking\nspeed for 10 seconds.";
                sourceRectSprite = new Rectangle(24, 168, 24, 24);
                break;

            case PotionType.FireBall:
                itemName         = "Elixir of Fireball";
                itemDescription  = "Grants the player a single\nfireball charge to fire.";
                sourceRectSprite = new Rectangle(24, 48, 24, 24);
                break;

            default:
                break;
            }

            rectCurrentSprite = sourceRectSprite;
            rectFirstSprite   = sourceRectangle;
        }
コード例 #10
0
        public Inventory(Spritesheet spritesheet, Vector2 position) : base(spritesheet, position)
        {
            spritesheet.SetFrameCount(new Point(5, 1));
            spritesheet.Interval = 100;

            pixelMain.SetData(colorDataSadBrown);
            pixelLayer1.SetData(colorDataDGray);
            pixelInvTile.SetData(colorDataBlack);
            IsActive   = false;
            DragMode   = false;
            Opacity    = 0.8f;
            rectMain   = new Rectangle(Game1.ScreenWidth - invMainWidth - invMainMarginX, invMainMarginY, invMainWidth, Game1.ScreenHeight - invMainMarginY * 2);
            rectLayer1 = new Rectangle(rectMain.X + invLayer1MarginX, rectMain.Y + invLayer1MarginY, rectMain.Width - invLayer1MarginX * 2, rectMain.Height - invLayer1MarginY * 2);

            Instance = this;
            CreateTiles();
        }
コード例 #11
0
ファイル: Player.cs プロジェクト: Thegemsearcher/CoT5
        public Player(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, groundPositionOffset, depthSortingOffset, stats, map, grid, player)
        {
            attackRange = 150;

            light            = new PointLight();
            light.Scale      = new Vector2(1000, 1500).ToCartesian();
            light.Intensity  = 1f;
            light.ShadowType = ShadowType.Solid;
            GameManager.Instance.Penumbra.Lights.Add(light);
            Scale        = 3;
            speed        = 200f;
            LayerDepth   = 0.2f;
            bottomHitBox = new FloatRectangle(new Vector2(Position.X, Position.Y + (int)(spritesheet.SourceRectangle.Height * 0.90 * Scale)),
                                              new Vector2(spritesheet.SourceRectangle.Width * Scale, (spritesheet.SourceRectangle.Height * Scale) / 10));

            OverhealDegradeInterval = 300f;
            CanFireBall             = 0;
            spritesheet.SetFrameCount(new Point(5, 1));
            spritesheet.Interval = 100;
            hpBar = new HealthBar(stats.MaxHealth, 0.6f /*new Vector2(200, 25)*/, new Vector2(50, 50));
        }
コード例 #12
0
ファイル: Projectile.cs プロジェクト: Thegemsearcher/CoT5
 public Projectile(Spritesheet spritesheet, Vector2 position, Vector2 direction, float speed) : base(spritesheet, position, direction, speed)
 {
     this.Direction = direction;
 }
コード例 #13
0
ファイル: Treent.cs プロジェクト: Thegemsearcher/CoT5
 public Treent(Spritesheet spritesheet, Vector2 position, Vector2 groundPositionOffset, Vector2 depthSortingOffset, Stats stats, Map map, Grid grid, Player player) : base(spritesheet, position, groundPositionOffset, depthSortingOffset, stats, map, grid, player)
 {
     attackRange = 100;
     aggroRange  = 600;
     speed       = 100f;
 }
コード例 #14
0
ファイル: Tile.cs プロジェクト: Thegemsearcher/CoT5
 public Tile(TileType tileType, Spritesheet spritesheet)
 {
     TileType    = tileType;
     Spritesheet = spritesheet;
 }
コード例 #15
0
ファイル: Player.cs プロジェクト: Thegemsearcher/CoT5
        public void Animation()
        {
            if (currentPlayerState != PlayerState.Idle && currentPlayerState != PlayerState.Attacking)
            {
                switch (facingDirection)
                {
                case FacingDirection.North:
                    Spritesheet.SetFrameCount(new Point(5, 5));
                    Spritesheet.SetCurrentFrame(20);
                    break;

                case FacingDirection.NorthEast:
                    Spritesheet.SetFrameCount(new Point(5, 9));
                    Spritesheet.SetCurrentFrame(40);
                    break;

                case FacingDirection.East:
                    Spritesheet.SetFrameCount(new Point(5, 3));
                    Spritesheet.SetCurrentFrame(10);
                    break;

                case FacingDirection.SouthEast:
                    Spritesheet.SetFrameCount(new Point(5, 6));
                    Spritesheet.SetCurrentFrame(25);
                    break;

                case FacingDirection.South:
                    Spritesheet.SetFrameCount(new Point(5, 4));
                    Spritesheet.SetCurrentFrame(15);
                    break;

                case FacingDirection.SouthWest:
                    Spritesheet.SetFrameCount(new Point(5, 7));
                    Spritesheet.SetCurrentFrame(30);
                    break;

                case FacingDirection.West:
                    Spritesheet.SetFrameCount(new Point(5, 2));
                    Spritesheet.SetCurrentFrame(5);
                    break;

                case FacingDirection.NorthWest:
                    Spritesheet.SetFrameCount(new Point(5, 8));
                    Spritesheet.SetCurrentFrame(35);
                    break;
                }
            }
            else if (currentPlayerState == PlayerState.Idle && !playAttackAnimation)
            {
                Spritesheet.SetFrameCount(new Point(5, 1));
                Spritesheet.SetCurrentFrame(0);
            }

            if (playAttackAnimation)
            {
                Spritesheet.SetFrameCount(new Point(5, 10));
                Spritesheet.SetCurrentFrame(45);
                Spritesheet.Interval = 50;

                if (Spritesheet.CurrentFrame >= 49)
                {
                    playAttackAnimation = false;
                }
            }

            if (!playAttackAnimation)
            {
                Spritesheet.Interval = 100;
            }
        }
コード例 #16
0
 public InventoryTile(Vector2 position, int tileSize, Texture2D pixel, Spritesheet texture) : base(texture, position)
 {
     this.pixel = pixel;
     rectangle  = new Rectangle((int)position.X, (int)position.Y, tileSize, tileSize);
 }