示例#1
0
    /// <summary>
    /// These actions return a Boolean to verify their completion.
    /// These actions may modify the agents position.
    /// </summary>

    /// <summary>
    /// Idle does nothing until next decision is made
    /// </summary>
    public bool Idle()
    {
        //AnimatorBody.Play("Idle");
        AiData.currentBehavior = AIData.Behave.Idle;
        if (ActionTimer < 0)
        {
            if (actionAvailable)
            {
                AiData.InstantiateSignal(1f, "Fear", -0.2f, false, true);
                actionAvailable = false;
            }
            return(true);
        }
        else
        {
            ActionTimer -= Time.deltaTime;
            return(false);
        }
    }
示例#2
0
    public virtual void Feed(IngredientData[] ingredientArray, bool fedByPlayer)
    {
        //Debug.Log("Skewer of size " + ingredientArray.Length);
        for (int i = 0; i < ingredientArray.Length; i++)
        {
            IngredientData ingredient = ingredientArray[i];
            if (ingredientCountDictionary.ContainsKey(ingredient.displayName))
            {
                ingredientCountDictionary[ingredient.displayName] = ingredientCountDictionary[ingredient.displayName] + 1;
                //Debug.Log("Ate one " + ingredient.displayName);
            }
            else
            {
                ingredientCountDictionary.Add(ingredient.displayName, 1);
                //Debug.Log("Ate one " + ingredient.displayName);
            }

            // mod hunger
            if (characterData != null)
            {
                characterData.InstantiateSignal(0.5f, "Hunger", -0.5f, false, true);
            }


            for (int f = 1; f <= 64; f = f << 1)
            {
                if ((f & (int)ingredient.flavors) > 0)
                {
                    RecipeData.Flavors foundFlavor = (RecipeData.Flavors)f;
                    flavorCountDictionary[foundFlavor] = flavorCountDictionary[foundFlavor] + 1;
                    Debug.Log(ingredient.displayName + " has flavor " + foundFlavor);
                }
            }
        }

        RespondToIngredients(fedByPlayer);
        SpawnReward(ingredientArray, fedByPlayer);
    }