Пример #1
0
        /// <summary>
        /// Adds a behaviour simulator to this object. This behaviour is executed repeatedly, and the return value of the behaviour enumerable
        /// is used as a waiting period until the next frame.
        /// The behaviour is automatically stopped when the object is removed.
        /// </summary>
        /// <param name="islandAddon"></param>
        /// <param name="stepBehaviour"></param>
        public void AddBehaviour(SceneGraphNode node, IEnumerable <float> stepBehaviour)
        {
            var sim = new ClockedBehaviourSimulator(stepBehaviour);

            clockedBehaviourSimulators.Add(sim);
            node.ObserveDestroy(() => clockedBehaviourSimulators.Remove(sim));
        }
Пример #2
0
        public TextPanelNode CreateTextPanelNode(SceneGraphNode node)
        {
            var ret = new TextPanelNode(this, node);

            TextPanelNodes.Add(ret);
            node.ObserveDestroy(() =>
            {
                TextPanelNodes.Remove(ret);
                ret.Dispose();
            });
            return(ret);
        }
Пример #3
0
        public EntityInteractableNode CreateEntityInteractable(EntityNode entityNode, SceneGraphNode createChild, Action onInteract)
        {
            var ret = new EntityInteractableNode(entityNode, createChild, onInteract);

            InteractableNodes.Add(ret);
            createChild.ObserveDestroy(() =>
            {
                InteractableNodes.Remove(ret);
                ret.Dispose();
            });
            return(ret);
        }
Пример #4
0
        /// <summary>
        /// TODO: fix for better DI
        /// </summary>
        /// <param name="sceneGraphNode"></param>
        /// <returns></returns>
        public EntityNode CreateEntityNode(SceneGraphNode node)
        {
            var ret = new EntityNode(this, node, worldOctree);

            EntityNodes.Add(ret);

            worldOctree.AddWorldObject(ret);
            node.ObserveDestroy(() =>
            {
                EntityNodes.Remove(ret);
                worldOctree.RemoveWorldObject(ret);
                ret.Dispose();
            });
            return(ret);
        }