コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        //Initialise singleton patterns, game states and default variable values.
        bm           = this;
        gameState    = GameState.HIVE_VIEW;
        weekProgress = 0;
        weekNumber   = 1;

        //Construct new beehive.
        beehive = new Beehive(numberOfFrames, startingPopulation);
        beehive.setHoney(startingHoney);
        UpdateScreenFrame(beehive.beehiveFrames[0]);
    }
コード例 #2
0
        public IEnumerator TestRateGeneration()
        {
            SceneManager.LoadScene("MainScene");
            yield return(null);

            BeehiveManager bm = MonoBehaviour.FindObjectOfType <BeehiveManager>();

            Assert.IsNotNull(bm);

            bm.selectedCell = 0;
            bm.ClickOnCell(Vector3Int.zero);
            bm.ClickOnCell(Vector3Int.right);
            bm.ClickOnCell(Vector3Int.left);

            Assert.AreEqual(3, bm.GetTileAmount(bm.honeydrop));
        }
コード例 #3
0
        public IEnumerator TestFlowerGeneration()
        {
            SceneManager.LoadScene("MainScene");
            yield return(null);

            BeehiveManager bm = Object.FindObjectOfType <BeehiveManager>();

            Assert.IsNotNull(bm);
            MapGenerator mg = bm.GetComponent <MapGenerator>();

            Assert.IsNotNull(mg);
            bm.EnterMapView();
            int flowers_real = mg.renderTexture.GetComponentsInChildren <Flower>().Count();

            Assert.AreEqual(mg.numFlowers, flowers_real);
        }
コード例 #4
0
        public IEnumerator TestRoyalJellyUsage()
        {
            SceneManager.LoadScene("MainScene");
            yield return(null);

            BeehiveManager bm = MonoBehaviour.FindObjectOfType <BeehiveManager>();

            Assert.IsNotNull(bm);

            int originalJelly = 100;

            Debug.Log("Current Jelly after 0 seconds: " + originalJelly.ToString());
            bm.selectedCell = 0;
            bm.beehive.setJelly(originalJelly);
            bm.queenHealthRate = 100f;
            yield return(new WaitForSeconds(0.5f));

            Debug.Log("Current Jelly after 0.5 seconds: " + bm.beehive.currentJelly.ToString());
            Assert.AreNotEqual(bm.beehive.currentJelly, originalJelly, "Jelly has not been used here.");
        }
コード例 #5
0
        public IEnumerator TestRoyalJellyGeneration()
        {
            SceneManager.LoadScene("MainScene");
            yield return(null);

            BeehiveManager bm = MonoBehaviour.FindObjectOfType <BeehiveManager>();

            Assert.IsNotNull(bm);

            bm.selectedCell = 0;
            bm.overlayTilemap.FloodFill(Vector3Int.zero, bm.jelly);
            bm.ClickOnCell(Vector3Int.zero);
            Debug.Log("Jelly Tiles" + bm.GetTileAmount(bm.honeydrop));
            bm.beehive.setHoney(100000);
            bm.beehive.setPollen(300000);
            yield return(new WaitForSeconds(0.5f));

            Debug.Log("Current Jelly after 0.5 seconds: " + bm.beehive.currentJelly.ToString());
            Assert.Greater(bm.beehive.currentJelly, 0, "Not enough royal jelly.");
        }
コード例 #6
0
        public IEnumerator TestFlowerRandomisationGeneration()
        {
            SceneManager.LoadScene("MainScene");
            yield return(null);

            BeehiveManager bm = Object.FindObjectOfType <BeehiveManager>();

            Assert.IsNotNull(bm);
            MapGenerator mg = bm.GetComponent <MapGenerator>();

            Assert.IsNotNull(mg);
            bm.EnterMapView();

            foreach (Flower f in mg.renderTexture.GetComponentsInChildren <Flower>())
            {
                Assert.IsNotNull(f.description);
                Assert.IsNotNull(f.successChance);
                Assert.IsNotNull(f.reward);
                Assert.IsNotNull(f.beesRequired);
                Assert.IsNotNull(f.GetComponent <SpriteRenderer>());
            }
        }