示例#1
0
        public static EntityGameWorld build(TransformComponent p_rootGround)
        {
            EntityGameWorld l_instance = new EntityGameWorld();

            l_instance.RootGround = p_rootGround;
            return(l_instance);
        }
示例#2
0
        private void onEntityCreated(Entity p_entity)
        {
            AssociatedEntity = p_entity;
            AssociatedEntity.EntityGameWorldInstanceID = new EntityGameWorldInstanceID()
            {
                ID = GetInstanceID()
            };

            AssociatedEntity.EntityGameWorld = EntityGameWorld.build(TransformComponent.alloc());
            TransformComponentSynchronizer.alloc(AssociatedEntity.EntityGameWorld.RootGround);
            EntityModelTransformSynchronizer = TransformSynchronizer.alloc(transform,
                                                                           AssociatedEntity.EntityGameWorld.RootGround.TransformComponentSynchronizer);
            TransformSynchronizerContainer.TransformSynchronizers.Add(EntityModelTransformSynchronizer);

            MyEvent <Entity> .IEventCallback l_onEntityDestroyed = OnEntityDestroyed.build(this);
            MyEvent <Entity> .register(
                ref this.AssociatedEntity.OnEntityDestroyed,
                ref l_onEntityDestroyed);

            // Initializing Entity components
            EntityDefinition.Initialize(
                ref this.EntityDefinition,
                ref this.AssociatedEntity,
                this.RuntimeObject.RuntimeObjectRootComponent);

            NavigationNode l_randomNavigationNode = NavigationGraphAlgorithm.pickRandomNode(NavigationGraphComponentContainer.UniqueNavigationGraphComponent.NavigationGraph);

            EventQueue.enqueueEvent(EventQueueContainer.TurnTimelineQueue, NavigationNodeWarpEntityEvent.alloc(AssociatedEntity, l_randomNavigationNode));

            AnimationVisualFeedback l_animationVisualFeedbackComponent = EntityComponent.get_component <AnimationVisualFeedback>(AssociatedEntity);

            if (l_animationVisualFeedbackComponent != null)
            {
                EventQueue.enqueueEvent(EventQueueContainer.TurnTimelineQueue,
                                        AnimationVisualFeedbackPlayAsyncEvent.alloc(l_animationVisualFeedbackComponent, AnimationLayers.BASE,
                                                                                    l_animationVisualFeedbackComponent.AnimationVisualFeedbackData.GetAnimation(AnimationLookupTag.IDLE).GetAnimationInput()));
            }
        }
示例#3
0
        public static void orientTowards(ref EntityGameWorld p_entityGameWorld, Entity p_targetEntiry, float3 p_projectionPlaneNormal)
        {
            float3 p_direction = math.normalize(p_targetEntiry.EntityGameWorld.RootGround.WorldPosition - p_entityGameWorld.RootGround.WorldPosition).ProjectOnPlane(p_projectionPlaneNormal);

            orientTowards(ref p_entityGameWorld, ref p_direction);
        }
示例#4
0
 public static void orientTowards(ref EntityGameWorld p_entityGameWorld, ref float3 p_worldDirection)
 {
     p_entityGameWorld.RootGround.WorldRotation = quaternion.LookRotationSafe(p_worldDirection, math.up());
 }