コード例 #1
0
        /// <param name="amount">MyFixedPoint.MaxValue to remove object</param>
        internal static void RemoveFloatingObject(MyFloatingObject obj, MyFixedPoint amount)
        {
            if (amount <= 0)
            {
                Debug.Fail("RemoveFloatingObject, amount must be > 0");
                return;
            }

            if (amount < obj.Item.Amount)
            {
                obj.Item.Amount -= amount;
                obj.RefreshDisplayName();
            }
            else
            {
                obj.Close();
            }

            obj.WasRemovedFromWorld = true;

            if (Sync.IsServer)
            {
                SyncObject.SendRemoveFloatingObjectSuccess(obj, amount);
            }

            m_requestedEntities.Remove(obj.EntityId);
            m_stableObjectsClient.Remove(obj);
            m_stableObjectsServer.Remove(obj);
        }
コード例 #2
0
        /// <param name="amount">MyFixedPoint.MaxValue to remove object</param>
        internal static void RemoveFloatingObject(MyFloatingObject obj, MyFixedPoint amount)
        {
            if (amount <= 0)
            {
                Debug.Fail("RemoveFloatingObject, amount must be > 0");
                return;
            }

            if (amount < obj.Item.Amount)
            {
                obj.Item.Amount -= amount;
                obj.RefreshDisplayName();
            }
            else
            {
                obj.Close();
            }

            obj.WasRemovedFromWorld = true;

            if (Sync.IsServer)
            {
                SyncObject.OnRemoveFloatingObject(obj, amount);
            }
        }
コード例 #3
0
 internal static void RemoveFloatingObject(MyFloatingObject obj, MyFixedPoint amount)
 {
     if (amount > 0)
     {
         if (amount < obj.Item.Amount)
         {
             obj.Amount.Value -= amount;
             obj.RefreshDisplayName();
         }
         else
         {
             obj.Render.FadeOut = false;
             obj.Close();
             obj.WasRemovedFromWorld = true;
         }
     }
 }
コード例 #4
0
        /// <param name="amount">MyFixedPoint.MaxValue to remove object</param>
        internal static void RemoveFloatingObject(MyFloatingObject obj, MyFixedPoint amount)
        {
            if (amount <= 0)
            {
                Debug.Fail("RemoveFloatingObject, amount must be > 0");
                return;
            }

            if (amount < obj.Item.Amount)
            {
                obj.Item.Amount -= amount;
                obj.RefreshDisplayName();
                //In this case do not use obj.WasRemovedFromWorld = true; cause it causes the object not being picked up after removed by the collector
            }
            else
            {
                obj.Close();
                obj.WasRemovedFromWorld = true;
            }
        }