// Update is called once per frame
    void Update()
    {
        lotusLastCount = localLotusList.Count;
        localLotusList = lotusCloverManager.LotusList;



        // New Lotus Added
        if (lotusLastCount < localLotusList.Count)
        {
            SwarmFish fish = new SwarmFish(swarmFishTemplate, Random.insideUnitSphere * 1);
            swarmFishSchool.Add(fish);
            foreach (SwarmFish swarmFish in swarmFishSchool)
            {
                swarmFish.lotusCloverTarget = localLotusList[lotusLastCount].pos;
                swarmFish.Swarm(swarmFishSchool);
                swarmFish.WanderThroughLotus();
                swarmFish.Move();
            }
        }
        // Nothing Changed since Last Time
        else if (lotusLastCount > 0)
        {
            if (timer == 400)
            {
                int selected = Random.Range(0, lotusLastCount);
                foreach (SwarmFish swarmFish in swarmFishSchool)
                {
                    swarmFish.lotusCloverTarget = localLotusList[selected].pos;
                    swarmFish.Swarm(swarmFishSchool);
                    swarmFish.WanderThroughLotus();
                    swarmFish.Move();
                }
            }
            else if (timer % 400 == 0)
            {
                Vector3 currentClover = lotusCloverManager.ReturnLastClover();
                foreach (SwarmFish swarmFish in swarmFishSchool)
                {
                    swarmFish.lotusCloverTarget = currentClover;
                    swarmFish.Swarm(swarmFishSchool);
                    swarmFish.WanderThroughLotus();
                    swarmFish.Move();
                }
            }

            else
            {
                foreach (SwarmFish swarmFish in swarmFishSchool)
                {
                    swarmFish.Swarm(swarmFishSchool);
                    swarmFish.WanderThroughLotus();
                    swarmFish.Move();
                }
            }
        }

        if (timer == 4800)
        {
            timer = 0;
        }

        timer++;
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (bannerManager.InBanner && bannerManager.CurrentBanner != null)
        {
            string currentBanner = bannerManager.CurrentBanner;

            switch (currentBanner)
            {
            case "gege":
                GegeUpdate();
                break;

            case "heluo":
                HeluoUpdate();
                break;

            case "wenyao":
                WenyaoUpdate();
                break;

            case "bo":
                BoUpdate();
                break;

            case "xixi":
                XixiUpdate();
                break;

            case "rupi":
                RupiUpdate();
                break;

            default:
                break;
            }
        }


        foreach (WanderFish fish in gegeShoal)
        {
            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.Move();
        }

        foreach (WanderFish fish in heluoShoal)
        {
            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.Move();
        }

        foreach (WanderFish fish in wenyaoShoal)
        {
            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.Move();
        }

        foreach (WanderFish fish in boShoal)
        {
            Vector3 cloverPos = lotusCloverManager.ReturnLastClover();

            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.TowardsClover(cloverPos);
            fish.Move();
        }
        foreach (WanderFish fish in xixiShoal)
        {
            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.Move();
        }
        foreach (WanderFish fish in rupiShoal)
        {
            fish.Wander();
            fish.Boundary();
            fish.Centric();
            fish.Move();
        }
    }