Esempio n. 1
0
    public void Dance()
    {
        bool flag = false;

        for (int i = 0; i < antList.Count; i++)
        {
            try
            {
                CNormalAnt emp = (CNormalAnt)antList[i];
                if (emp)
                {
                    flag = true;
                    break;
                }
            }
            catch { }
        }
        if (flag)
        {
            SoundManager.instance.se07dance.Play();
        }
        for (int i = 0; i < antList.Count; i++)
        {
            antList[i].Dance();
        }
    }
Esempio n. 2
0
    public void UpdateObjectTile(bool flag, Vector2Int v)
    {
        Tile tile;

        if (0 > v.x || v.x >= mapW || 0 > v.y || v.y >= mapH)
        {
            tile = Tile.데드존;
        }

        if (flag)
        {
            tile = GetTile(tileItem, v);
            if (tile == Tile.마늘 || tile == Tile.응가 || tile == Tile.꿀)
            {
                colArray[v.x, v.y] -= Time.deltaTime;
                if (colArray[v.x, v.y] <= 0)
                {
                    SetTile(tileItem, v, Tile.공백);
                    SetTile(v, Tile.흙);
                }
            }
            else if (tile == Tile.나뭇잎)
            {
                if (colArray[v.x, v.y] <= 0)
                {
                    SetTile(tileItem, v, Tile.공백);
                    SetTile(v, Tile.흙);
                }
            }
            else if (tile == Tile.방울)
            {
                shiledArray[v.x, v.y] -= Time.deltaTime;
                if (shiledArray[v.x, v.y] <= 0)
                {
                    SetTile(tileItem, v, Tile.공백);
                    SetTile(v, Tile.흙);
                }
            }
            else if (tile == Tile.데드존)
            {
                if (CAntManager.Instance.AntLocationCheck(v))
                {
                    SoundManager.instance.se05away.Play();
                    CAnt ant = CAntManager.Instance.GetAnt(v);
                    CAntManager.Instance.DeadAnd(ant);
                }
            }
            else if (tile == Tile.끝)
            {
                if (CAntManager.Instance.AntLocationCheck(v))
                {
                    SoundManager.instance.se05away.Play();
                    CAnt ant = CAntManager.Instance.GetAnt(v);
                    try
                    {
                        CMineAnt emp0 = (CMineAnt)ant;
                        if (emp0)
                        {
                            GameManager.instance.nowMineNormalAnt += 1;
                            //Debug.Log("채굴개미 : " + GameManager.instance.nowMineNormalAnt);
                        }
                    }
                    catch { }

                    try
                    {
                        CNormalAnt emp1 = (CNormalAnt)ant;
                        if (emp1)
                        {
                            GameManager.instance.nowNormalAnt += 1;
                            //Debug.Log("일반개미 : " + GameManager.instance.nowNormalAnt);
                        }
                    }
                    catch { }
                    CAntManager.Instance.DeadAnd(ant);
                }
            }
        }
        else
        {
            tile = GetTile(tileMap, v);
            if (tile == Tile.데드존)
            {
                if (CAntManager.Instance.AntLocationCheck(v))
                {
                    SoundManager.instance.se05away.Play();
                    CAnt ant = CAntManager.Instance.GetAnt(v);
                    CAntManager.Instance.DeadAnd(ant);
                }
            }
        }
    }
Esempio n. 3
0
    void GameEndCheck()
    {
        if (EndGame)
        {
            return;
        }

        if (nowNormalAnt >= normalAntTargetAmount && nowMineNormalAnt >= mineAntTargetAmount)
        {
            GameResult = 1;
            SoundManager.instance.se03succes.Play();
            UIManager.instance.winUI.SetActive(true);
            EndGame = true;
            return;
        }

        if (timeLimit <= 0)
        {
            GameResult = 2;
            SoundManager.instance.se04fail.Play();
            UIManager.instance.loseUI.SetActive(true);
            EndGame = true;
            return;
        }

        if (AntNumFlag)
        {
            int minenum   = 0;
            int normalnum = 0;

            for (int i = 0; i < CAntManager.Instance.antList.Count; i++)
            {
                CAnt ant = CAntManager.Instance.antList[i];
                try
                {
                    CMineAnt emp0 = (CMineAnt)ant;
                    if (emp0)
                    {
                        minenum++;
                    }
                }
                catch { }

                try
                {
                    CNormalAnt emp1 = (CNormalAnt)ant;
                    if (emp1)
                    {
                        normalnum++;
                    }
                }
                catch { }
            }

            if (minenum < (mineAntTargetAmount - nowMineNormalAnt) || normalnum < (normalAntTargetAmount - nowNormalAnt))
            {
                GameResult = 2;
                SoundManager.instance.se04fail.Play();
                UIManager.instance.loseUI.SetActive(true);
                EndGame = true;
                return;
            }
        }
    }