Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    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);
    }
Exemplo n.º 4
0
    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);
    }
Exemplo n.º 5
0
//	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";
    }
Exemplo n.º 6
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;
            }
        }
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
    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;
 }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     UIscript = FindObjectOfType <UIscript>();
     animator = GetComponent <Animator>();
 }
Exemplo n.º 11
0
 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>();
 }
Exemplo n.º 12
0
	// Update is called once per frame
	void Update () {
		texts = GameObject.FindGameObjectWithTag ("Counter").GetComponent<UIscript> ();
		texts.counter = counter;

	}