Ejemplo n.º 1
0
    void Update()
    {
        if ((((showPlan == true && transform.childCount == 3) || (showPlan == false && transform.childCount == 2)) && plan.Count == 1))
        {
            //blackBoard.GetTaskTree(clan).RemoveNode(this);
            plan[0] = blackBoard.GetActionForAgent(clan, this);             //returns "IdleAction" if no actions are possible
            if (showPlan == true)
            {
                StartCoroutine(((PlanGUI)gameObject.transform.FindChild("PlanGUI").GetComponent("PlanGUI")).FadeTo(0.0f, 1.0f));                //fades the gui out
                StartCoroutine(((PlanGUI)gameObject.transform.FindChild("PlanGUI").GetComponent("PlanGUI")).FadeTo(1.0f, 1.0f));                // fades the gui in
            }
            //blackBoard.GetTaskTree(clan).PrintTree();
            AddSubsystem();
        }
        else if (transform.childCount == 2 && plan.Count > 1)
        {
            //ta bort som ägare till noden? och gör resten av planen
            if (showPlan == true)
            {
                StartCoroutine(((PlanGUI)gameObject.transform.FindChild("PlanGUI").GetComponent("PlanGUI")).FadeTo(0.0f, 1.0f));                //fades the gui out
                StartCoroutine(((PlanGUI)gameObject.transform.FindChild("PlanGUI").GetComponent("PlanGUI")).FadeTo(1.0f, 1.0f));                // fades the gui in
            }

            plan.RemoveAt(0);
            AddSubsystem();
        }



        Collectskill = skillArray["collectSkillpoints"];
        Buildskill   = skillArray["buildSkillpoints"];
    }