protected void RaiseOnPositionChanged(MyPositionComponentBase component)
        {
            var handle = OnPositionChanged;

            if (handle != null)
            {
                handle(component);
            }
        }
예제 #2
0
 void Components_ComponentRemoved(Type t, Sandbox.Common.Components.MyComponentBase c)
 {
     if (t == typeof(MyPhysicsComponentBase))
         m_physics = null;
     else if (t == typeof(MySyncComponentBase))
         m_syncObject = null;
     else if (t == typeof(MyGameLogicComponent))
         m_gameLogic = null;
     else if (t == typeof(MyPositionComponentBase))
         m_position = null;
     else if (t == typeof(MyHierarchyComponentBase))
         m_hierarchy = null;
     else if (t == typeof(MyRenderComponentBase))
     {
         m_render = null;
     }
 }
 protected void RaiseOnPositionChanged(MyPositionComponentBase component)
 {
     var handle = OnPositionChanged;
     if (handle != null) handle(component);
 }
예제 #4
0
 void Components_ComponentAdded(Type t, Sandbox.Common.Components.MyComponentBase c)
 {
     if (t == typeof(MyPhysicsComponentBase))
         m_physics = c as MyPhysicsBody;
     else if (t == typeof(MySyncComponentBase))
         m_syncObject = c as MySyncComponentBase;
     else if (t == typeof(MyGameLogicComponent))
         m_gameLogic = c as MyGameLogicComponent;
     else if (t == typeof(MyPositionComponentBase))
         m_position = c as MyPositionComponentBase;
     else if (t == typeof(MyHierarchyComponentBase))
         m_hierarchy = c as MyHierarchyComponentBase;
     else if (t == typeof(MyRenderComponentBase))
     {
         m_render = c as MyRenderComponentBase;
     }
 }
 private static void OnCreatedEntityPositionChanged(MyPositionComponentBase obj)
 {
     if (obj.Entity.Save == false)
     {
         MyEncounterId id;
         if (m_entityToEncounterConversion.TryGetValue(obj.Entity, out id))
         {
             Vector3D newPosition = obj.GetPosition();
             if (Vector3D.Distance(id.PlacePosition, newPosition) > m_minDistanceToRecognizeMovement)
             {
                 m_movedOnlyEncounters[id] = obj.GetPosition();
             }
         }
     }
 }