public GreenTree(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 155, 261), new StaticAnimatedSprites(cowGameScreen.GameTextures["greenTreeMovement"], 1, 0)) { _world = world; _cowGameScreen = cowGameScreen; float width = (float)14 / 100; float height = (float)1 / 100; float x = (float)(DestRect.X + DestRect.Width - 80) / 100; float y = (float)(DestRect.Y + DestRect.Height - 22) / 100; Body = BodyFactory.CreateRectangle(world, width, height, 0f, new Vector2(x, y)); Body.BodyType = BodyType.Static; Body.BodyTypeName = "tree"; world.ContactManager.Contacted += TreeCollides; world.AddStaticEntity(this); }
public Apple(CowGameScreen cowGameScreen, World world, GreenTree tree, Rectangle destRect) : base(cowGameScreen, new StaticAnimatedSprites(cowGameScreen.GameTextures["appleMovement"], 1, 0), cowGameScreen.GameTextures["appleIcon"]) { _origin.X = ItemMovement.SpriteWidth / 2; _origin.Y = ItemMovement.SpriteHeight / 2; ItemId = 0; StackCount = 3; _eatenAppleMovement = cowGameScreen.GameTextures["eatenAppleMovement"]; _tree = tree; Body = BodyFactory.CreateCircle(world, (float)1 / 100, 0.2f, new Vector2((float)destRect.X / 100, (float)destRect.Y / 100)); DestRect = destRect; Body.BodyType = BodyType.Dynamic; Body.BodyTypeName = "apple"; Body.CollisionCategories = Category.Cat10; Body.CollidesWith = Category.Cat10; Satiety = 10f; CurrentWorld = world; CurrentWorld.ContactManager.Contacted += AppleFloorContacted; }
public Grass(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 25, 51), new StaticAnimatedSprites(cowGameScreen.GameTextures["grassMovement"], 1, 0)) { _currentAnim = PlantMovement; _eatenGrassMovement = new StaticAnimatedSprites(cowGameScreen.GameTextures["eatenGrassMovement"], 1, 0); CurrentWorld = world; Body = BodyFactory.CreateRectangle(world, (float)DestRect.Width / 100, (float)DestRect.Height / 200, 0, new Vector2((float)(DestRect.X + DestRect.Width / 2) / 100, (float)(DestRect.Y + 30) / 100)); Body.BodyTypeName = "grass"; Body.BodyType = BodyType.Static; Body.CollisionCategories = Category.Cat10; Body.CollidesWith = Category.Cat10; ReapaintTexture = TextureHelper.RepaintRectangle(TextureHelper.CopyTexture(PlantMovement.Animation, Graphics)); CanInteract = true; world.AddStaticEntity(this); _eatedTime = TimeSpan.Zero; }
public Cow(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 54, 49), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowRightWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowLeftWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowUpWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowDownWalk"], 3, 16)) { Inventory = new Inventory.Inventory(cowGameScreen); CraftPanel = new CraftPanel(cowGameScreen); ListBars = new List <StatusBar> { new HealthBar(cowGameScreen, this), new FoodBar(cowGameScreen, this), new SprintBar(cowGameScreen, this) }; Delay = 200f; HealthPoint = 100; StarvePoint = 100; CurrentWorld = world; Boost = 1; SpeedX = 1.5f; SpeedY = 1f; CurrentWorld = world; _interactableList = new List <Entity>(); _attackList = new List <Entity>(); _previousFocusInteractables = new HashSet <Entity>(); _previousFocusAttackables = new HashSet <Entity>(); Body = BodyFactory.CreateRectangle(world, 0.54f, 0.15f, 0, new Vector2((float)DestRect.X / 100, (float)DestRect.Y / 100)); Body.BodyType = BodyType.Dynamic; Body.CollisionCategories = Category.All & ~Category.Cat10; Body.CollidesWith = Category.All & ~Category.Cat10; CurrentAnim = LeftWalk; Body.BodyTypeName = "cow"; CowGameScreen.WordlsList.ForEach(worldInList => worldInList.ContactManager.Nearby += NearbyCow); }
public Chicken(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 56, 46), new DynamicAnimatedSprites(cowGameScreen.GameTextures["whiteChickenRightWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["whiteChickenLeftWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["whiteChickenUpWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["whiteChickenDownWalk"], 3, 0)) { Body = BodyFactory.CreateRectangle(world, 0.22f, 0.05f, 0, position / 100); Body.CollisionCategories = Category.All; Body.CollidesWith = Category.All; Body.BodyType = BodyType.Dynamic; Body.BodyTypeName = "chicken"; Delay = 400f; SpeedX = 0.7f; SpeedY = 0.6f; HealthPoint = 20; Rnd = new Random(2); CurrentAnim = RightWalk; CurrentWorld = world; WayList = new List<Vector2> { new Vector2(100, 500), new Vector2(800, 500) }; world.AddDynamicEntity(this); }
public BoulderRock(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 140, 115), new StaticAnimatedSprites(cowGameScreen.GameTextures["boulderRockMovement"], 1, 0)) { float x1 = (float)(DestRect.X + 20) / 100; float x2 = (float)(DestRect.X + DestRect.Width - 15) / 100; float y1 = (float)(DestRect.Y + DestRect.Height - 40) / 100; float y2 = (float)(DestRect.Y + DestRect.Height - 45) / 100; Body = BodyFactory.CreateEdge(world, new Vector2(x1, y1), new Vector2(x2, y2)); x1 = (float)(DestRect.X + 19) / 100; x2 = (float)(DestRect.X + 60) / 100; y2 = (float)(DestRect.Y + DestRect.Height - 20) / 100; Body = BodyFactory.CreateEdge(world, new Vector2(x1, y1), new Vector2(x2, y2)); x1 = x2; y1 = y2; x2 = (float)(DestRect.X + DestRect.Width - 13) / 100; y2 = (float)(DestRect.Y + DestRect.Height - 45) / 100; Body = BodyFactory.CreateEdge(world, new Vector2(x1, y1), new Vector2(x2, y2)); world.AddStaticEntity(this); }
public Inventory(CowGameScreen cowGameScreen) { _cowGameScreen = cowGameScreen; _typesIds = ItemsTypesHelper.GetItemsTypes(); _indexOnFocus = 0; StartPosition = new Vector2(330, 827); EndPosition = new Vector2(StartPosition.X + _cowGameScreen.GameTextures["inventoryPanel"].Width, StartPosition.Y); _containersOnFocus = new HashSet <Container>(); _prevContainersOnFocus = new HashSet <Container>(); var pos = new Vector2(StartPosition.X + 25, StartPosition.Y + 9); _containers = new StaticConainer[9]; for (var i = 0; i < _containers.Length; i++) { var rect = new Rectangle((int)pos.X, (int)pos.Y, 42, 42); _containers[i] = new StaticConainer(rect, cowGameScreen.GameTextures["cleanTexture"]); pos.X += 13 + rect.Width; } SwapContainer = new SwapContainer(Rectangle.Empty); }
public Cat(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 56, 46), new DynamicAnimatedSprites(cowGameScreen.GameTextures["catRightWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["catLeftWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["catUpWalk"], 3, 0), new DynamicAnimatedSprites(cowGameScreen.GameTextures["catDownWalk"], 3, 0)) { Rnd = new Random(100); CurrentWorld = world; CurrentAnim = RightWalk; Body = BodyFactory.CreateRectangle(CurrentWorld, 0.28f, 0.05f, 0, position / 100); Body.CollisionCategories = Category.All; Body.CollidesWith = Category.All; Body.BodyType = BodyType.Dynamic; Body.BodyTypeName = "cat"; Delay = 500f; SpeedX = 0.8f; SpeedY = 0.7f; CurrentWorld.AddDynamicEntity(this); WayList = new List <Vector2> { new Vector2(100, 100), new Vector2(800, 100) }; }
public ChickenLeg(CowGameScreen cowGameScreen, AnimatedSprites itemMovement, Texture2D iconTexture) : base(cowGameScreen, itemMovement, iconTexture) { ItemId = 5; Satiety = 20f; StackCount = 6; }
protected StatusBar(CowGameScreen cowGameScreen, Cow cow) { _cowGameScreen = cowGameScreen; _cow = cow; }
protected Button(CowGameScreen cowGameScreen) { CowGameScreen = cowGameScreen; }
protected Plant(CowGameScreen cowGameScreen, World world, Rectangle destRect, StaticAnimatedSprites plantMovement) : base(cowGameScreen, world) { Graphics = cowGameScreen.Graphics; DestRect = destRect; PlantMovement = plantMovement; }
protected Entity(CowGameScreen cowGameScreen, World world) { CowGameScreen = cowGameScreen; CurrentWorld = world; }
public WorkBench(CowGameScreen cowGameScreen) : base(cowGameScreen) { }
public Rope(CowGameScreen cowGameScreen) : base(cowGameScreen, new StaticAnimatedSprites(cowGameScreen.GameTextures["ropeMovement"], 1, 0), cowGameScreen.GameTextures["ropeIcon"]) { ItemId = 3; StackCount = 3; }
public CutGrass(CowGameScreen cowGameScreen) : base(cowGameScreen, new StaticAnimatedSprites(cowGameScreen.GameTextures["cutGrassMovement"], 1, 0), cowGameScreen.GameTextures["cutGrassIcon"]) { ItemId = 2; StackCount = 9; Satiety = 5f; }
protected AlertWindow(CowGameScreen cowGameScreen) { CowGameScreen = cowGameScreen; Buttons = new List <Button>(); }
protected Decoration(CowGameScreen cowGameScreen, World world, Rectangle destRect, StaticAnimatedSprites decorationMovement) : base(cowGameScreen, world) { this.DestRect = destRect; this.DecorationMovement = decorationMovement; this.ObjectMovingType = ObjectMovingType.Static; }
public MainMenuButton(CowGameScreen cowGameScreen, Vector2 position) : base(cowGameScreen) { Position = new Rectangle((int)position.X, (int)position.Y, 205, 35); ButtonTexture = CowGameScreen.GameTextures["mainMenuButton"]; }
public Log(CowGameScreen cowGameScreen) : base(cowGameScreen, new StaticAnimatedSprites(cowGameScreen.GameTextures["logMovement"], 1, 0), cowGameScreen.GameTextures["logIcon"]) { ItemId = 4; StackCount = 6; }
public SprintBar(CowGameScreen cowGameScreen, Cow cow) : base(cowGameScreen, cow) { _drawRect = new Rectangle((int)cow.Inventory.EndPosition.X, (int)cow.Inventory.EndPosition.Y - 19, 18, 18); _drawRect.X -= _drawRect.Width + 1; }
public FoodBar(CowGameScreen cowGameScreen, Cow cow) : base(cowGameScreen, cow) { _drawRect = new Rectangle((int)cow.Inventory.EndPosition.X - 19, (int)cow.Inventory.EndPosition.Y - 19, 18, 18); }
public Twigs(CowGameScreen cowGameScreen, World world, Vector2 position) : base(world, new Rectangle((int)position.X, (int)position.Y, 30, 23), new AnimatedSprites(cowGameScreen.GameTextures["rocksMovement"], 1, 0), cowGameScreen.GameTextures["rocksIcon"]) { }
public Rocks(CowGameScreen cowGameScreen) : base(cowGameScreen, new StaticAnimatedSprites(cowGameScreen.GameTextures["rocksMovement"], 1, 0), cowGameScreen.GameTextures["rocksIcon"]) { ItemId = 1; StackCount = 2; }
protected Item(CowGameScreen cowGameScreen, AnimatedSprites itemMovement, Texture2D iconTexture) : base(cowGameScreen, null) { IconTexture = iconTexture; ItemMovement = itemMovement; ObjectMovingType = ObjectMovingType.Static; }
public HealthBar(CowGameScreen cowGameScreen, Cow cow) : base(cowGameScreen, cow) { _drawRect = new Rectangle((int)cow.Inventory.StartPosition.X, (int)cow.Inventory.StartPosition.Y - 19, 18, 18); }