private void InitFood() { Random rand = new Random(); food = new Food(world); uiFood = new UIFood(food, world); food.Width = uiFood.Width / 2; food.InitPositionWithTile(world.GetTileAt(rand.Next(0, Context.Instance.TileWidth), rand.Next(0, Context.Instance.TileHeight))); food.Notify(); }
void InitializeFoods() { foreach (Food f in foods) { GameObject go = Instantiate(foodButtonPrefab, foodParent); UIFood uiFood = go.GetComponent <UIFood>(); uiFood.SetFood(f); uiFood.manager = this; } }
// Use this for initialization void Start() { //Initialis the food, weapons and powerups vars, then update all UI. food = GameObject.FindGameObjectWithTag("Statics").GetComponent <UIFood> (); weapons = GameObject.FindGameObjectWithTag("Statics").GetComponent <UIWeapons> (); powerups = GameObject.FindGameObjectWithTag("Statics").GetComponent <Powerups> (); updateFoodUI(); updateWeaponUI(); updatePowerupGUI(); ObjectiveHandler.inst.UpdateUI(); //Object.DontDestroyOnLoad (transform.gameObject); }
// Use this for initialization void Start () { //Initialis the food, weapons and powerups vars, then update all UI. food = GameObject.FindGameObjectWithTag ("Statics").GetComponent<UIFood> (); weapons = GameObject.FindGameObjectWithTag ("Statics").GetComponent<UIWeapons> (); powerups = GameObject.FindGameObjectWithTag ("Statics").GetComponent<Powerups> (); updateFoodUI (); updateWeaponUI (); updatePowerupGUI (); ObjectiveHandler.inst.UpdateUI (); //Object.DontDestroyOnLoad (transform.gameObject); }