Ejemplo n.º 1
0
    public override void Absorb(Resource resource)
    {
        base.Absorb(resource);

        foreach (var recipe in recipes)
        {
            if (recipe.ingredients.Count > ResourcesAbsorbed.Count)
            {
                continue;
            }

            int requiredIngredientsRemaining = recipe.ingredients.Count;
            foreach (var ingredient in recipe.ingredients)
            {
                if (ResourcesAbsorbed.Contains(ingredient))
                {
                    requiredIngredientsRemaining--;
                }
            }

            // Create the plant!
            if (requiredIngredientsRemaining <= 0)
            {
                Debug.Log(recipe.result);

                ResourcesAbsorbed.Clear();
                ResourcesAbsorbed.TrimExcess();
                StartCoroutine(ExposeAndActivate(recipe));
                return;
            }
        }
    }
Ejemplo n.º 2
0
    public override void Absorb(Resource resource)
    {
        base.Absorb(resource);

        if (ResourcesAbsorbed.Contains(Resource.Money))
        {
            ResourcesAbsorbed.Remove(Resource.Money);
            ResourcesAbsorbed.TrimExcess();
            var go = Instantiate(seedPrefab, null);
            go.transform.position = this.transform.position;
            go.transform.DOMove(spawnHere.transform.position, 0.3f);
        }
    }