void makeDirt() { timer -= Time.deltaTime; if (timer <= 0) { Dirt dirt = new Dirt(ref cleanMeter); sponge.addDirt(dirt); AddChild(dirt); timer = 1000; } }
public Scene(string path, CurrencySystem currency, Level level, int scene, int price = 400, Tutorial tutorial = null) : base() { // _tutorial = tutorial; this.scene = scene; _currency = currency; visible = false; this.level = level; isActive = false; canMakeFood = true; tank = new Sprite(path); downArrow = new Sprite("downarrow.png"); downArrow.SetXY(game.width / 2, game.height - 200); downArrow.SetScaleXY(0.2f); foodList = new List <Food>(); AddChildAt(tank, 0); AddChild(downArrow); priceOfAquarium = price; fishListPerScene = new List <Fish>(); DisplayFishInScene fishes = new DisplayFishInScene(scene, foodList, fishListPerScene); sponge = new Sponge(this); shop = new Shop(fishListPerScene, level); inv = new Inventory(); clickToBuy = new Sprite("checkers.png"); clickToBuy.width = 200; clickToBuy.height = 200; clickToBuy.y += 300; AddChild(clickToBuy); foodCan = new Sprite("fish_food.png"); foodCan.SetOrigin(foodCan.width / 4, 0); foodCan.width /= 5; foodCan.height /= 5; for (int i = 0; i < 30; i++) { Dirt dirt = new Dirt(ref cleanMeter); sponge.addDirt(dirt); AddChild(dirt); } AddChild(shop); shop.visible = false; cleanDirtWithSponge = new Sound("sponge_use_sound.wav", true, true); //spongeClean = cleanDirtWithSponge.Play(); //spongeClean.Stop(); repairAquarium = new Sound("repair_aquarium_sound.wav", false, true); makeFoodSound = new Sound("fish_food_pick_sound.wav", false, true); openShop = new Sound("opening_journal_shop_sound.wav", false, true); // openShopSoundChannel = openShop.Play(); }
private void BallBallCollisionDetection() { for (int i = 0; i < dirtList.Count; i++) { Dirt mover = dirtList[i] as Dirt; Vec2 relativePosition = _position - mover._position; if (relativePosition.Magnitude() < _radius + mover._radius) { _currentScene.removeDirtConsequence(mover); removeDirt(mover); mover.LateDestroy(); // return true; } } // return false; }
public void removeDirt(Dirt dirt) { dirtList.Remove(dirt); }
public void addDirt(Dirt dirt) { dirtList.Add(dirt); }
public void removeDirtConsequence(Dirt dirt) { cleanMeter -= dirt.cleanImpact; }