Beispiel #1
0
    /// <summary>
    /// Creates a new DecisionTree and sets it to the PlaceCreator.Tree
    /// </summary>
    public void CreateDecisionTree()
    {
        HidingSpots = new List <HidingSpot>();
        Tree        = new DecisionTree();
        foreach (BoxCollider place in places)
        {
            HidingSpot placeSpot = place.transform.GetComponent <HidingSpot>();
            placeSpot.EnableUI();
            placeSpot.ID = placeSpot.name.GetHashCode();
            DecisionNode node        = DecisionNode.CreateChild(Tree.RootNode, placeSpot, TypeOfObject.PLACE);
            Collider[]   hidingSpots = Physics.OverlapBox(place.bounds.center, place.bounds.size / 2, Quaternion.identity, HidingLayer);


            foreach (Collider spot in hidingSpots)
            {
                HidingSpot hSpot = spot.GetComponent <HidingSpot>();
                hSpot.ID = hSpot.transform.position.GetHashCode();
                DecisionNode.CreateChild(node, hSpot, TypeOfObject.PLACE);

                hSpot.EnableUI();
                HidingSpots.Add(hSpot);
            }
        }
    }