Exemplo n.º 1
0
    public static bool Usable(Plant.Type t)
    {
        if (PL == null)
        {
            PL = FindObjectOfType <Player>();
        }
        if (GS == null)
        {
            GS = FindObjectOfType <GameSystem>();
        }
        if (PA == null)
        {
            PA = FindObjectOfType <PlayerAttack>();
        }
        if (GS.dayOrNight == GameSystem.DayOrNight.Day)
        {
            switch (t)
            {
            case Plant.Type.Aquabud:
                return(PL.health < 300F);

            case Plant.Type.Goji:
                return(PL.gojiBuffCnt < 5);

            case Plant.Type.Mulberry:
                return(PL.mulberryBuffCnt < 5);

            case Plant.Type.Wisplum:
                return(PL.wisplumBuffCnt < 3);

            default:
                return(false);
            }
        }
        else
        {
            switch (t)
            {
            case Plant.Type.Lime:
                return(true);

            case Plant.Type.Cloudberry:
                return(true);

            case Plant.Type.Lychee:
                return(PL.element == Player.Element.Water);

            case Plant.Type.Cyanberry:
                return(PL.element == Player.Element.Water);

            case Plant.Type.Mango:
                return(PL.element == Player.Element.Water);

            case Plant.Type.Turret:
                return(PA.CanUseItem());

            case Plant.Type.Bubble:
                return(PA.CanUseItem());

            case Plant.Type.Persimmon:
                return(PA.CanUseItem());

            case Plant.Type.Jujube:
                return(PA.CanUseItem());

            case Plant.Type.Dragonfruit:
                return(PA.CanUseItem());

            default:
                return(false);
            }
        }
        return(false);
    }