Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        Source     = GetComponent <AudioSource>();
        meshRender = this.GetComponent <MeshRenderer>();
        filter     = this.GetComponent <MeshFilter>();

        Destroy(this.gameObject, lifetime);

        myType = (FishTypes)Random.Range(0, 4);
        switch (myType)
        {
        case FishTypes.Dory:
            filter.mesh = meshes[0];
            filter.transform.rotation   = Quaternion.identity;
            filter.transform.localScale = new Vector3(50f, 40f);
            meshRender.material         = materials[0];
            break;

        case FishTypes.Nemo:
            filter.mesh         = meshes[1];
            meshRender.material = materials[1];
            break;

        case FishTypes.Sun:
            filter.mesh         = meshes[2];
            meshRender.material = materials[2];
            break;

        case FishTypes.Hairtail:
            filter.mesh         = meshes[3];
            meshRender.material = materials[3];
            break;
        }
    }
Exemplo n.º 2
0
 protected void FishDead(FishTypes fishType)
 {
     if (eFishDied != null)
     {
         eFishDied(fishType);
     }
     Debug.Log("Fish was dead");
 }
Exemplo n.º 3
0
        private double GetAmountFishFoodNeeded(FishTypes fishType)
        {
            switch (fishType)
            {
            case FishTypes.GoldFish:
                return(0.1);

            case FishTypes.AngelFish:
                return(0.2);

            case FishTypes.BabelFish:
                return(0.3);
            }

            return(0);
        }
Exemplo n.º 4
0
        public void CheckFishAddedToTank()
        {
            //Populated from UI
            string    fishName = "Fishy McFishman";
            FishTypes fishType = FishTypes.GoldFish;

            Fish fishToAdd = new Fish
            {
                FishName = fishName,
                FishType = fishType
            };

            Tank tank = new Tank();

            tank.AddFishToTank(fishToAdd);

            List <Fish> fishInTheTank = tank.fishInTank;

            Assert.IsNotNull(fishInTheTank, $"There are {fishInTheTank.Count} fish in the tank.");
        }
Exemplo n.º 5
0
        public bool UpdateFishTypes()
        {
            try
            {
                var types = FishType.GetFishTypes();

                if (types != null)
                {
                    FishTypes.Clear();
                    foreach (var type in types)
                    {
                        FishTypes.Add(type);
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public void CheckFoodRequiredPopulates()
        {
            //Populated from UI
            string    fishName = "Fishy McFishman";
            FishTypes fishType = FishTypes.GoldFish;

            Fish fishToAdd = new Fish
            {
                FishName = fishName,
                FishType = fishType
            };

            Tank tank = new Tank();

            tank.AddFishToTank(fishToAdd);

            double expected = 0.1;
            double actual   = tank.fishInTank[0].FoodRequired;

            Assert.AreEqual(expected, actual, 0.001, "Fish Food not Correctly Setup");
        }