示例#1
0
    public bool CheckIfSame(Fruit f)
    {
        string myProps = name + myType.ToString() + xp + energy + bellyValue;
        string otherProps = f.name + f.getType().ToString() + f.getXP() + f.getEnergy() + f.getBellyVal();

        if (myProps == otherProps)
        {
            return true;
        }
        return false;
    }
示例#2
0
    //If there is room, eat the given fruit
    //Returns whether the fruit was eaten
    public bool EatFruit(Fruit f)
    {
        if ((GetBellyFullness() + f.getBellyVal()) > bellyCapacity)
        {
            return false;
        }

        fruitList.Add(f.GetClone());

        return true;
    }