void processTouch(int i) { Touch touch = Input.GetTouch(i); if (touch.phase == TouchPhase.Moved) { if (wm.activeBread.GetComponent <Bread>().spreading&& knife.transform.position.x - wm.activeBread.transform.position.x > 2.3f) { wm.activeBread.GetComponent <Bread>().stopSpreading(); } knife.transform.position = Camera.main.ScreenToWorldPoint(touch.position) + new Vector3(0, 0, 4f); } else if (touch.phase == TouchPhase.Began) { knife.GetComponent <Knife>().deleteTrails(); knife.GetComponent <Knife>().newTrail(); if (wm.activeBread.GetComponent <Bread>().spreading) { wm.activeBread.GetComponent <Bread>().stopSpreading(); } else { knife.transform.position = Camera.main.ScreenToWorldPoint(touch.position) + new Vector3(0, 0, 4f); knife.transform.eulerAngles = Vector3.zero; } downLoc = Camera.main.ScreenToWorldPoint(touch.position) + new Vector3(0, 0, 4f); downTime = Time.time; } else if (touch.phase == TouchPhase.Ended) { wm.activeBread.GetComponent <Bread>().stopSpreading(); upLoc = Camera.main.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, 4f); //Check if shorthand swipe validation is fulfilled bool quickswipe = ((Vector3.Distance(downLoc, wm.sauce.transform.position) < wm.sauce.GetComponent <BoxCollider2D>().size.x / 2f || knife.GetComponent <Knife>().hasSauce) && Time.time - downTime <0.45f && upLoc.x + 0.5f> wm.activeBread.transform.position.x) && Vector3.Distance(downLoc, upLoc) > 0.3f && upLoc.y < wm.activeBread.transform.position.y + 9f; // if (quickswipe) { em.swipe(); } downTime = 0; } }
public static void reset() { WorldManager wm = Util.wm; EconomyManager em = Util.em; wm.playthroughCount++; //transfer into totals em.elixir += elixirsOnReset(); em.totalElixir += elixirsOnReset(); em.lifetimeMoney += em.totalMoney; em.lifetimeSandwichesMade += em.sandwichesMade; em.lifetimeBuildings += em.buildings; em.lifetimeSwipes += em.totalSwipes; //reset to defaults em.money = 0; em.totalMoney = 0; em.knifeVamp = 0; //amount of the total cps gained on each swipe em.sauceID = 1; //which is the current spread em.breadID = 0; em.gameTime = 0f; em.rate = 0; em.sandwichValue = 0; em.totalSwipes = 0; //ButtonHandler.buyCount = 1; em.buildings = 0; em.sandwichCartCount = 0; em.deliCount = 0; em.autochefCount = 0; em.mcdandwichCount = 0; em.sandwichCityCount = 0; em.breadCloningCount = 0; em.sandwocracyCount = 0; em.sandriaLawCount = 0; em.sandwichPlanetCount = 0; em.humanExterminationCount = 0; em.sandwichFleetCount = 0; em.enslaveAliensCount = 0; em.deathSandwichCount = 0; em.sandwichGalaxyCount = 0; em.flyingSandwichMonsterCount = 0; em.nurseryPop = 0; em.reproductionRate = 0; wm.sm.hasFlux = false; wm.sm.hasBreadclear = false; wm.sm.hasSandtanium = false; wm.sm.timeMachineDone = false; wm.sm.storyProgress = 0; wm.sm.oldwichLevel = 0; wm.tutorialManager.tutorialActive = false; //temp mute bool tempMute = wm.muted; wm.muted = true; //redo calculations em.recalculate(); wm.sm.updatePermanentTab(); wm.sm.level0(); wm.sm.setActiveFlux(true); wm.sm.setActiveBreadclear(true); wm.sm.setActiveSandtanium(true); wm.tabManager.selectProducer(); em.list.transform.FindChild("BuyCounterSwitchPanel1").FindChild("SwitchButton").gameObject.GetComponent <Switch>().setx1(); em.updateProducerMenuCounters(); wm.sauce.GetComponent <Sauce>().update(); Bread.updateLabel(); em.swipe(); em.money = 0; em.moneyText.updateColor(); GameObject.Find("FIRE").GetComponent <Animator>().SetTrigger("FireFade"); wm.muted = tempMute; em.save(); #if UNITY_ANDROID Social.ReportProgress("CgkI1rDm6sMKEAIQAg", 100.0f, (bool success) => { }); #elif UNITY_IOS Social.ReportProgress("timetraveler", 100.0f, (bool success) => { }); #endif if (RESET != null) { RESET(); } }