Exemple #1
0
    void FindTarget()
    {
        var       children    = GetNode("/root/World").GetChildren();
        ArrayList FlowerSlots = new ArrayList();

        foreach (var c in children)
        {
            if (c is FlowerSlot)
            {
                if (((FlowerSlot)c).GetState() != FlowerPot.PotState.EMPTY)
                {
                    FlowerSlots.Add((FlowerSlot)c);
                }
            }
        }

        var rand = new Random();

        if (FlowerSlots.Count > 0)
        {
            mDestination = (FlowerSlot)FlowerSlots[rand.Next(FlowerSlots.Count)];
        }
        else
        {
            QueueFree();
        }
    }
Exemple #2
0
    void FindTarget()
    {
        var       children    = GetNode("/root/World").GetChildren();
        ArrayList FlowerSlots = new ArrayList();

        foreach (var c in children)
        {
            if (c is FlowerSlot)
            {
                if (((FlowerSlot)c).GetState() != FlowerPot.PotState.EMPTY)
                {
                    FlowerSlots.Add((FlowerSlot)c);
                }
            }
        }


        if (FlowerSlots.Count > 0)
        {
            mDestination = (FlowerSlot)FlowerSlots[rand.Next(FlowerSlots.Count)];
            LookAt(mDestination.GetTranslation(), Vector3.Up);
            SetRotationDegrees(new Vector3(0.0f, GetRotationDegrees().y, GetRotationDegrees().z));
        }
        else
        {
            QueueFree();
        }
    }