// Start is called before the first frame update void Start() { canvas mainCanvas = FindObjectOfType <canvas>(); totalTime = timeBetweenFlash + timeToShow; transform.parent = mainCanvas.transform; transform.position = new Vector3(mainCanvas.GetComponent <RectTransform>().rect.width / 2, 3 * mainCanvas.GetComponent <RectTransform>().rect.height / 5, 0); }
public void create() { GuiTextEditCtrl MeshName = FOT("MeshName"); GuiCheckBoxCtrl MeshMissionBounds = FOT("MeshMissionBounds"); string name = MeshName.getText(); if (name == "" || Util.nameToID(name) > 0) { messageBox.MessageBoxOK("Error", "A NavMesh must have a unique name!"); return; } NavMesh mesh = "0"; SimSet MissionGroup = "MissionGroup"; if (MeshMissionBounds.isStateOn()) { if (!Util.isObject(MissionGroup)) { messageBox.MessageBoxOK("Error", "You must have a MissionGroup to use the mission bounds function."); return; } // Get maximum extents of all objects. string box = MissionBoundsExtents(MissionGroup); Point3F pos = Util.getBoxCenter(box.AsBox3F()); string scale = (Util.getWord(box, 3).AsInt() - Util.getWord(box, 0).AsInt()) / 2 + 5 + " " + (Util.getWord(box, 4).AsInt() - Util.getWord(box, 1).AsInt()) / 2 + 5 + " " + (Util.getWord(box, 5).AsInt() - Util.getWord(box, 2).AsInt()) / 2 + 5; var oc = new ObjectCreator("NavMesh", name); oc["position"] = pos; oc["scale"] = scale; mesh = oc.Create(); } else { GuiTextEditCtrl MeshPosition = FOT("MeshPosition"); GuiTextEditCtrl MeshScale = FOT("MeshScale"); var oc = new ObjectCreator("NavMesh", name); oc["position"] = MeshPosition.getText(); oc["scale"] = MeshScale.getText(); mesh = oc.Create(); } MissionGroup.add(mesh); NavEditorGui NavEditorGui = "NavEditorGui"; canvas Canvas = "Canvas"; NavEditorGui.selectObject(mesh); Canvas.popDialog(this); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } DontDestroyOnLoad(gameObject); }
public void toggle() { canvas Canvas = "Canvas"; if (isAwake()) { Canvas.setContent("PlayGui"); } else { Canvas.setContent("HudlessPlayGui"); } }
void Increase(string elem) { if (elem == null) { return; } char[] name = elem.ToCharArray(); Data.total++; canvas cn = (C.GetComponent <canvas> ()); if (name [0] == 'O') { Data.O++; } else if (name [0] == 'H') { Data.H++; } else if (name [0] == 'A') { Data.S++; } else if (name [0] == 'C' && name [0] == 'l') { Data.Cl++; } else if (name [0] == 'F') { Data.P++; } else if (name [0] == 'N') { Data.N++; } else if (name [0] == 'C' && name [0] == 'a') { Data.C++; } else if (name [0] == 'S') { Data.Na++; } cn.Elemento(elem); if (Data.total == 8) { Application.LoadLevel("Recoleccion"); } }
static void Main(string[] args) { var sheaps = new List <Shape>(); sheaps.Add(new Shape { Width = 100, Hight = 100, Type = ShapeType.Circle }); sheaps.Add(new Shape { Width = 100, Hight = 30, Type = ShapeType.Rectangle }); var canvas = new canvas(); canvas.DrowShape(sheaps); }
// Start is called before the first frame update void Start() { Vector2 playerPosition = FindObjectOfType <Player>().transform.position; float angle = Random.Range(0f, 360f); float xDirection = distanceAway * Mathf.Cos(angle); float yDirection = distanceAway * Mathf.Sin(angle); Vector2 offset = new Vector2(xDirection, yDirection); transform.position = playerPosition + offset; canvasHolder = FindObjectOfType <canvas>(); shopManager = FindObjectOfType <ShopManager>(); //3 random resources to buy int indexOfResource1 = Random.Range(0, listOfResources.Count - 1); int indexOfResource2 = Random.Range(0, listOfResources.Count - 1); int indexOfResource3 = Random.Range(0, listOfResources.Count - 1); while (listOfResources[indexOfResource1].nameOfResource == listOfResources[indexOfResource2].nameOfResource || listOfResources[indexOfResource1].nameOfResource == listOfResources[indexOfResource3].nameOfResource || listOfResources[indexOfResource2].nameOfResource == listOfResources[indexOfResource3].nameOfResource) { indexOfResource1 = Random.Range(0, listOfResources.Count - 1); indexOfResource2 = Random.Range(0, listOfResources.Count - 1); indexOfResource3 = Random.Range(0, listOfResources.Count - 1); } ShopItemInfo buyItem1 = new ShopItemInfo(); buyItem1.name = listOfResources[indexOfResource1].nameOfResource; buyItem1.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource1].nameOfResource] * additionalCostMultiplier); canvasHolder.friendlyBuyShop.GetComponent <Shop>().addShopItem(buyItem1); shopManager.listOfResources[0] = listOfResources[indexOfResource1]; ShopItemInfo buyItem2 = new ShopItemInfo(); buyItem2.name = listOfResources[indexOfResource2].nameOfResource; buyItem2.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource1].nameOfResource] * additionalCostMultiplier); canvasHolder.friendlyBuyShop.GetComponent <Shop>().addShopItem(buyItem2); shopManager.listOfResources[1] = listOfResources[indexOfResource2]; ShopItemInfo buyItem3 = new ShopItemInfo(); buyItem3.name = listOfResources[indexOfResource3].nameOfResource; buyItem3.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource1].nameOfResource] * additionalCostMultiplier); canvasHolder.friendlyBuyShop.GetComponent <Shop>().addShopItem(buyItem3); shopManager.listOfResources[2] = listOfResources[indexOfResource3]; //generate 3 random resources to sell indexOfResource1 = Random.Range(0, listOfResources.Count - 1); indexOfResource2 = Random.Range(0, listOfResources.Count - 1); indexOfResource3 = Random.Range(0, listOfResources.Count - 1); while (listOfResources[indexOfResource1].nameOfResource == listOfResources[indexOfResource2].nameOfResource || listOfResources[indexOfResource1].nameOfResource == listOfResources[indexOfResource3].nameOfResource || listOfResources[indexOfResource2].nameOfResource == listOfResources[indexOfResource3].nameOfResource) { indexOfResource1 = Random.Range(0, listOfResources.Count - 1); indexOfResource2 = Random.Range(0, listOfResources.Count - 1); indexOfResource3 = Random.Range(0, listOfResources.Count - 1); } ShopItemInfo sellItem1 = new ShopItemInfo(); sellItem1.name = listOfResources[indexOfResource1].nameOfResource; sellItem1.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource1].nameOfResource] * additionalCostMultiplier); sellItem1.sellItem = true; canvasHolder.friendlySellShop.GetComponent <Shop>().addShopItem(sellItem1); itemsTraderIsSelling[0] = listOfResources[indexOfResource1].gameObject; ShopItemInfo sellItem2 = new ShopItemInfo(); sellItem2.name = listOfResources[indexOfResource2].nameOfResource; sellItem2.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource2].nameOfResource] * additionalCostMultiplier); sellItem2.sellItem = true; canvasHolder.friendlySellShop.GetComponent <Shop>().addShopItem(sellItem2); itemsTraderIsSelling[1] = listOfResources[indexOfResource2].gameObject; ShopItemInfo sellItem3 = new ShopItemInfo(); sellItem3.name = listOfResources[indexOfResource3].nameOfResource; sellItem3.cost = (int)(shopManager.resourceCost[listOfResources[indexOfResource3].nameOfResource] * additionalCostMultiplier); sellItem3.sellItem = true; canvasHolder.friendlySellShop.GetComponent <Shop>().addShopItem(sellItem3); itemsTraderIsSelling[2] = listOfResources[indexOfResource3].gameObject; health = maxHealth; timeTillDeletion = maxTimeBeforeDeletion; }
void Start() //Initial variable conifuration/setup { this.prefabs = new GameObject[4]; this.prefabs[0] = this.fish1; this.prefabs[1] = this.fish2; this.prefabs[2] = this.fish3; this.prefabs[3] = this.fish4; this.start = PlayerPrefs.GetInt("start"); this.prices = new int[4]; this.timePerFish = new int[4]; this.timeSinceAdded = new int[this.maxCap]; this.array = new GameObject[maxCap]; if (this.start == 0) { this.level = 0; this.maxCap = 30; this.money = 5000; this.numFish = 0; this.price1 = 20; this.price2 = 40; this.price3 = 80; this.price4 = 160; this.time1 = 18; this.time2 = 27; this.time3 = 36; this.time4 = 45; this.prices[0] = this.price1; this.prices[1] = this.price2; this.prices[2] = this.price3; this.prices[3] = this.price4; this.timePerFish[0] = this.time1; this.timePerFish[1] = this.time2; this.timePerFish[2] = this.time3; this.timePerFish[3] = this.time4; } else { this.level = PlayerPrefs.GetInt("Level"); this.maxCap = PlayerPrefs.GetInt("maxCap"); this.money = PlayerPrefs.GetInt("Money"); this.numFish = PlayerPrefs.GetInt("Fish"); this.prices[0] = PlayerPrefs.GetInt("price1"); this.prices[1] = PlayerPrefs.GetInt("price2"); this.prices[2] = PlayerPrefs.GetInt("price3"); this.prices[3] = PlayerPrefs.GetInt("price4"); this.timePerFish[0] = PlayerPrefs.GetInt("time1"); this.timePerFish[1] = PlayerPrefs.GetInt("time2"); this.timePerFish[2] = PlayerPrefs.GetInt("time3"); this.timePerFish[3] = PlayerPrefs.GetInt("time4"); } this.pos = 0; this.fishPrice = 20; this.setFish = 0; stats = GameObject.Find("stats"); this.globalStats = stats.GetComponent <numFish>(); info = stats.GetComponent <canvas> (); showText(); timeBonus(); addFishOnLoad(); // gets the count of gameobjects with "Tag" getSeconds(); InvokeRepeating("Save", 5, 5); InvokeRepeating("freeMoney", .01f, 3); }
if (base.Enable(canvas, log)) {
DrawNodeConnections(canvas, transformer, nodeWorldPosition, definitionNode.Connections, definitionNodes);
DrawNodeText(canvas, nodeWorldPosition, astarNode.Clearance);
DrawNode(canvas, nodeWorldPosition);
public RayTrace(int width, int heigth) { canvas = new canvas(width, heigth); }
void Start() { can = GameObject.Find("Canvas").GetComponent <canvas>(); gm = GameObject.Find("gamemanager").GetComponent <gameManager>(); index = 0; }
// Use this for initialization void Start() { canvasScript = new canvas(); bus = new vehicle(); endGame = false; }
Print(canvas, cursorPosition);