Exemple #1
0
 private static void DoIterate(GameObject gameObject, ChildHandler childHandler, bool recursive)
 {
     foreach (Transform child in gameObject.transform)
     {
         childHandler(child.gameObject);
         if (recursive)
             DoIterate(child.gameObject, childHandler, true);
     }
 }
Exemple #2
0
        public void Invoke(BSNavItem sender)
        {
            ActiveChild = sender;
            if (IsTabs)
            {
                TabRender?.Render();
            }

            ChildHandler?.Invoke(sender);
        }
Exemple #3
0
 /// <summary>
 /// Recursively iterates the object tree
 /// </summary>
 /// <param name="gameObject">Game object to iterate</param>
 /// <param name="childHandler">A handler function on node</param>
 /// <param name="recursive">Do it on recursively on children?</param>
 /// <remarks>NOTE: Recursive!!!</remarks>
 private static void DoIterate(GameObject gameObject, ChildHandler childHandler, bool recursive)
 {
     foreach (Transform child in gameObject.transform)
     {
         childHandler(child.gameObject);
         if (recursive)
         {
             DoIterate(child.gameObject, childHandler, true);
         }
     }
 }
Exemple #4
0
    public void Interact(InteractController controller)
    {
        ChildHandler childHandler = controller.GetComponentInChildren <ChildHandler>();

        if (childHandler.isEquipped)
        {
            Task task = TaskManager.instance.TaskExists(GameManager.TaskType.BABYSTEAL);
            if (task)
            {
                Debug.Log("Kid has been napped");
                childHandler.Destroy();
                task.Accomplish();
            }
        }
    }
Exemple #5
0
    public void Interact(InteractController controller)
    {
        ChildHandler childHandler = controller.GetComponentInChildren <ChildHandler>();

        ChildHandler currentHandler = GetComponentInParent <ChildHandler>();

        playerController = controller.GetComponent <PlayerController>();
        if (currentHandler && currentHandler.isEquipped && currentHandler != childHandler)
        {
            currentHandler.Remove();
        }

        if (childHandler.isEquipped)
        {
            childHandler.Remove();
            return;
        }

        childHandler.Equip(this);
    }
Exemple #6
0
    public void Interact(InteractController controller)
    {
        ChildHandler childHandler = controller.GetComponentInChildren <ChildHandler>();

        if (childHandler.isEquipped)
        {
            Task task = TaskManager.instance.TaskExists(GameManager.TaskType.BABYSTEAL);
            if (task)
            {
                feedbackText = Instantiate(feedbackTextPrefab, feedbackContainer.transform);
                feedbackText.GetComponent <Text>().text = "Kid has been napped";
                Destroy(feedbackText, 5.0f);
                childHandler.Destroy();
                task.Accomplish();
            }
            else
            {
                feedbackText = Instantiate(feedbackTextPrefab, feedbackContainer.transform);
                feedbackText.GetComponent <Text>().text = "Not now man! Now is not the time for that!";
                Destroy(feedbackText, 5.0f);
            }
        }
    }
Exemple #7
0
 /// <summary>
 /// Iterates all children of a game object
 /// </summary>
 /// <param name="gameObject">A root game object</param>
 /// <param name="childHandler">A function to execute on each child</param>
 /// <param name="recursive">Do it on recursively on children?</param>
 public static void IterateChildren(GameObject gameObject, ChildHandler childHandler, bool recursive)
 {
     DoIterate(gameObject, childHandler, recursive);
 }
Exemple #8
0
 /// <summary>
 /// Iterates all children of a game object
 /// </summary>
 /// <param name="gameObject">A root game object</param>
 /// <param name="childHandler">A function to execute on each child</param>
 /// <param name="recursive">Do it on recursively on children?</param>
 public static void IterateChildren(GameObject gameObject, ChildHandler childHandler, bool recursive)
 {
     DoIterate(gameObject, childHandler, recursive);
 }