Inheritance: BaseEntity
Esempio n. 1
0
        public void RemoveFloatingObject(FloatingObject floatingObject)
        {
            m_floatingObjectToChange = floatingObject;

            Action action = InternalRemoveFloatingObject;

            SandboxGameAssemblyWrapper.Instance.EnqueueMainGameAction(action);
        }
Esempio n. 2
0
        protected void InternalRemoveFloatingObject( )
        {
            if (m_floatingObjectToChange == null)
            {
                return;
            }

            Object backingObject = m_floatingObjectToChange.BackingObject;

            BaseObject.InvokeStaticMethod(InternalType, FloatingObjectManagerRemoveFloatingObjectMethod, new object[] { backingObject });

            m_floatingObjectToChange = null;
        }
        protected void InternalRemoveFloatingObject( )
        {
            if ( m_floatingObjectToChange == null )
                return;

            Object backingObject = m_floatingObjectToChange.BackingObject;
            BaseObject.InvokeStaticMethod( InternalType, FloatingObjectManagerRemoveFloatingObjectMethod, new object[ ] { backingObject } );

            m_floatingObjectToChange = null;
        }
        public void RemoveFloatingObject( FloatingObject floatingObject )
        {
            m_floatingObjectToChange = floatingObject;

            MySandboxGame.Static.Invoke( InternalRemoveFloatingObject );
        }
		public void RemoveFloatingObject( FloatingObject floatingObject )
		{
			m_floatingObjectToChange = floatingObject;

			Action action = InternalRemoveFloatingObject;
			SandboxGameAssemblyWrapper.Instance.EnqueueMainGameAction( action );
		}
Esempio n. 6
0
        public void RemoveFloatingObject(FloatingObject floatingObject)
        {
            m_floatingObjectToChange = floatingObject;

            MySandboxGame.Static.Invoke(InternalRemoveFloatingObject);
        }
        private void spawnMeteor(Vector3Wrapper spawnpos, Vector3Wrapper vel, Vector3Wrapper up, Vector3Wrapper forward)
        {
            if (SandboxGameAssemblyWrapper.IsDebugging)
            {
                LogManager.APILog.WriteLineAndConsole("Physics Meteroid - spawnMeteor(" + spawnpos.ToString() + ", " + vel.ToString() + ", " + up.ToString() + ", " + forward.ToString() + ")" );
            }
            MyObjectBuilder_FloatingObject tempobject;
            MyObjectBuilder_Ore tempore = new MyObjectBuilder_Ore();
            MyObjectBuilder_InventoryItem tempitem = new MyObjectBuilder_InventoryItem();
            tempore.SetDefaultProperties();
            FloatingObject physicsmeteor;
            m_ore_fctr = m_gen.NextDouble();

            tempitem = (MyObjectBuilder_InventoryItem)MyObjectBuilder_InventoryItem.CreateNewObject(m_InventoryItemType);
            tempitem.PhysicalContent = (MyObjectBuilder_PhysicalObject)MyObjectBuilder_PhysicalObject.CreateNewObject(m_OreType);
            tempitem.PhysicalContent.SubtypeName = getRandomOre();
            tempitem.AmountDecimal = Math.Round((decimal)(ore_amt * getOreFctr(tempitem.PhysicalContent.SubtypeName) * m_ore_fctr));
            if (tempitem.AmountDecimal < 1) tempitem.AmountDecimal = 1;
            tempitem.ItemId = 0;

            tempobject = (MyObjectBuilder_FloatingObject)MyObjectBuilder_FloatingObject.CreateNewObject(m_FloatingObjectType);
            tempobject.Item = tempitem;

            physicsmeteor = new FloatingObject(tempobject);
            physicsmeteor.Up = up;
            physicsmeteor.Forward = forward;
            physicsmeteor.Position = spawnpos;
            physicsmeteor.LinearVelocity = vel;
            physicsmeteor.MaxLinearVelocity = 104.7F * maxVelocityFctr;
            if (SandboxGameAssemblyWrapper.IsDebugging)
            {
                LogManager.APILog.WriteLineAndConsole("Meteor entityID: " + physicsmeteor.EntityId.ToString() + " Velocity: " + vel.ToString());
            }
            SectorObjectManager.Instance.AddEntity(physicsmeteor);
            //workaround for the velocity problem.
            Thread physicsthread = new Thread(() => velocityloop(physicsmeteor, vel));
            physicsthread.Start();
        }
        public void velocityloop(FloatingObject obj, Vector3Wrapper vel)
        {
            Thread.Sleep(20);
            for (int count = 20; count > 0; count--)
            {
                if (obj.Mass > 0)
                {
                    obj.MaxLinearVelocity = 104.7F * maxVelocityFctr;
                    obj.LinearVelocity = vel;
                    if (SandboxGameAssemblyWrapper.IsDebugging)
                    {
                        LogManager.APILog.WriteLineAndConsole("Meteor entityID: " + obj.EntityId.ToString() + " Velocity: " + vel.ToString());
                    }
                    break;
                }
                Thread.Sleep(20);
            }

            return;
        }