void Start() { BountError = BountyError.NoError; bountySize = GameObject.Find("BountySpotlight"); heroSpawn = GameObject.Find("HeroController").GetComponent <HeroSpawner>(); mymainmoney = GameObject.Find("GUIIncometab").GetComponent <MainMoney> (); spawnPointpos = gameObject.transform.position; spawnPointRot = gameObject.transform.rotation; buildingloc = GameObject.Find("BuildingManager").GetComponent <BuildingLocation> (); maxxz = heroSpawn.HowFarCanIGo(1); MaxX = maxxz [0]; MaxZ = maxxz [1]; }
// bounty menu stuff down here void OnGUI() { if (bountyMenu == true) { // GameObject.Find("BountySizeOnGround").transform.position= mouseHit.point+Vector3.up*2; bountySize.transform.position = new Vector3(mouseHit.point.x, 50, mouseHit.point.z); bountySize.GetComponent <Light> ().intensity = 8; GUI.Box(new Rect(50, 30, 300, 250), "Enter amount below to pay each hero"); bountyCoststring = GUI.TextField(new Rect(150, 50, 100, 20), bountyCoststring); int.TryParse(bountyCoststring, out bountyCost); GUI.Label(new Rect(70, 120, 100, 100), "Enter max amount of heroes allowed to respond below"); maxherotorespond = GUI.TextField(new Rect(70, 190, 50, 20), maxherotorespond); int.TryParse(maxherotorespond, out maxRespondToBounty); //52 max 15 min // left , top, width,hieght // GUI.Label(new Rect(70,70,150,30),"Size of Bounty Area"); // bountyRadius= GUI.HorizontalSlider(new Rect(70,90,100,30),bountyRadius,10.0f,50.0f); // // bountySize.transform.localScale= new Vector3(bountyRadius,0.1f,bountyRadius); GUI.Label(new Rect(70, 70, 150, 30), "Size of Bounty Area"); bountyRadius = GUI.HorizontalSlider(new Rect(70, 90, 100, 30), bountyRadius, 10.0f, 50.0f); bountySize.GetComponent <Light> ().spotAngle = bountyRadius; //toggle select for what kind of bounty it is if (bountyAttack == false && bountyGuard == false) { bountyExplore = GUI.Toggle(new Rect(200, 90, 100, 20), bountyExplore, "Explore Here"); } if (bountyExplore == false && bountyGuard == false) { bountyAttack = GUI.Toggle(new Rect(200, 120, 100, 20), bountyAttack, "Attack Here"); } if (bountyAttack == false && bountyExplore == false) { bountyGuard = GUI.Toggle(new Rect(200, 150, 100, 20), bountyGuard, "Guard Here"); } if (bountyGuard == true) { GUI.Label(new Rect(200, 70, 100, 50), "Time to guard for in seconds"); timeToGuardFor = GUI.TextField(new Rect(200, 110, 100, 20), timeToGuardFor); int.TryParse(timeToGuardFor, out timeToGuard); } if (GUI.Button(new Rect(70, 240, 100, 30), "Declare bounty")) { if (bountyCost <= 0) { BountError = BountyError.NoMoney; } else if (maxRespondToBounty <= 0) { BountError = BountyError.NoHero; } else if (bountyAttack == false && bountyExplore == false && bountyGuard == false) { BountError = BountyError.NoSelection; } else if ((bountyGuard == true) && timeToGuard <= 0) { BountError = BountyError.NoGuardTime; } else if (GameObject.FindGameObjectWithTag("PlayerTotals").GetComponent <MainMoney>().CanIBuy(bountyCost * maxRespondToBounty, false) != false) { BountError = BountyError.NoPlayerMoney; } else { NewBounty(bountyCost); bountyMenu = false; ableToRayCastForBounty = true; GameObject.Find("BountySizeOnGround").transform.position = mouseHit.point + Vector3.up * 200; } } if (GUI.Button(new Rect(230, 240, 100, 30), "Cancel")) { bountyMenu = false; bountyCoststring = ""; bountyCost = 0; timeToGuard = 0; timeToGuardFor = "60"; maxherotorespond = ""; maxRespondToBounty = 0; ableToRayCastForBounty = true; //GameObject.Find("BountySizeOnGround").transform.position= mouseHit.point+Vector3.up*200; bountyAttack = false; bountyExplore = false; bountyGuard = false; bountySize.GetComponent <Light> ().intensity = 0; } } }