public void collectingFoodIncreasesPoopAmount() { GameObject uiContainer = new GameObject(); UIscript ui = uiContainer.AddComponent <UIscript>(); ui.poopFill = uiContainer.AddComponent <Image>(); ui.pooAmount = 0; ui.poopFill.enabled = false; ui.foodCollected(); Assert.IsTrue(ui.pooAmount > 0 && ui.poopFill.enabled); }
public void poopingReducesPoopAmount() { GameObject uiContainer = new GameObject(); UIscript ui = uiContainer.AddComponent <UIscript>(); ui.poopFill = uiContainer.AddComponent <Image>(); ui.pooAmount = 1; ui.poopFill.enabled = true; ui.bowelMovement(); Assert.IsTrue(ui.pooAmount < 1 && !ui.poopFill.enabled); }
public void changeScoreChangesScoreText() { GameObject uiContainer = new GameObject(); UIscript ui = uiContainer.AddComponent <UIscript>(); uiContainer.AddComponent <AudioSource>(); UnityEngine.UI.Text txt = uiContainer.AddComponent <UnityEngine.UI.Text>(); ui.scoreText = txt; string scoreText = txt.text; ui.changeScore(100); Assert.AreNotEqual(scoreText, ui.scoreText.text); }
public void getCoinChangesCoinCounterText() { GameObject uiContainer = new GameObject(); UIscript ui = uiContainer.AddComponent <UIscript>(); uiContainer.AddComponent <AudioSource>(); UnityEngine.UI.Text txt = uiContainer.AddComponent <UnityEngine.UI.Text>(); ui.coinText = txt; string coinText = txt.text; ui.getCoin(); Assert.AreNotEqual(coinText, ui.coinText.text); }
// public UIscript(int scoreP) // { // score = scoreP; // } // Use this for initialization void Start() { if (instance == null) { instance = this; } else if (instance != this) { score = instance.score; Destroy(gameObject); } DontDestroyOnLoad(gameObject); scoreText = GetComponent <Text> (); scoreText.text = "0"; }
public void Awake() { _uiScript = canvas.GetComponent <UIscript>(); Collider2D[] colliders = GetComponents <Collider2D>(); gameOverScreen.SetActive(false); for (int i = 0; i < colliders.Length; i++) { if (colliders[i].isTrigger) { _collider = colliders[i]; break; } } }
public void spawnPoopSpawnsPoop() { GameObject fakeBird = new GameObject(); PoopSpawner spawner = fakeBird.AddComponent <PoopSpawner>(); UIscript ui = fakeBird.AddComponent <UIscript>(); UnityEngine.UI.Image img = fakeBird.AddComponent <UnityEngine.UI.Image>(); ui.poopFill = img; ui.poopFill.enabled = true; ui.pooAmount = 1; spawner.ui = ui; spawner.Start(); GameObject newPoop = spawner.spawnPoop(); Assert.IsNotNull(newPoop); }
public void spawnPoopDoesntSpawnPoopIfPoopBarIsEmpty() { GameObject fakeBird = new GameObject(); PoopSpawner spawner = fakeBird.AddComponent <PoopSpawner>(); UIscript ui = fakeBird.AddComponent <UIscript>(); UnityEngine.UI.Image img = fakeBird.AddComponent <UnityEngine.UI.Image>(); ui.poopFill = img; ui.poopFill.enabled = false; ui.pooAmount = 0; GameObject poop = new GameObject(); poop.AddComponent <PoopController>(); spawner.poop = poop; spawner.ui = ui; GameObject newPoop = spawner.spawnPoop(); Assert.IsNull(newPoop); }
// Use this for initialization void Start() { Instance = this; }
// Start is called before the first frame update void Start() { UIscript = FindObjectOfType <UIscript>(); animator = GetComponent <Animator>(); }
void Start() { pCol = GetComponent<SphereCollider>(); SwitchOff = false; keyCount = 0; dashed = false; anim = GetComponentInChildren<Animator>(); maxHP = HP; dashForce = 2000; dmObject = GameObject.FindGameObjectWithTag("Dm"); dm = dmObject.GetComponent<Dungeon_Manager>(); am = dmObject.GetComponent<Audio_Manager>(); audio_S = GetComponent<AudioSource>(); UIS = GameObject.FindGameObjectWithTag("Main Canvas").GetComponent<UIscript>(); rig = GetComponent<Rigidbody>(); }
// Update is called once per frame void Update () { texts = GameObject.FindGameObjectWithTag ("Counter").GetComponent<UIscript> (); texts.counter = counter; }