Difference between revisions of "API:Sandbox/ModAPI/IMyEntity"
From Space Engineers Wiki
(Created page with "{{subst:APIStub}}") |
GeneralWrex (talk | contribs) (→Examples) |
||
Line 6: | Line 6: | ||
== Examples == | == Examples == | ||
<syntaxhighlight lang="csharp"> | <syntaxhighlight lang="csharp"> | ||
− | + | using Sandbox.Common; | |
+ | using Sandbox.Common.Components; | ||
+ | using Sandbox.Common.ObjectBuilders; | ||
+ | using System; | ||
+ | using System.Collections.Generic; | ||
+ | using VRageMath; | ||
+ | |||
+ | namespace Sandbox.ModAPI | ||
+ | { | ||
+ | public interface IMyEntity | ||
+ | { | ||
+ | long EntityId { get; set; } | ||
+ | |||
+ | string Name { get; } | ||
+ | |||
+ | string DisplayName { get; set; } | ||
+ | |||
+ | bool MarkedForClose { get; } | ||
+ | |||
+ | bool Closed { get; } | ||
+ | |||
+ | MyGameLogicComponent GameLogic { get; set; } | ||
+ | |||
+ | MyEntityUpdateEnum NeedsUpdate { get; set; } | ||
+ | |||
+ | IMyEntity Parent { get; } | ||
+ | |||
+ | bool NearFlag { get; set; } | ||
+ | |||
+ | bool CastShadows { get; set; } | ||
+ | |||
+ | bool FastCastShadowResolve { get; set; } | ||
+ | |||
+ | bool NeedsResolveCastShadow { get; set; } | ||
+ | |||
+ | float MaxGlassDistSq { get; } | ||
+ | |||
+ | bool NeedsDraw { get; set; } | ||
+ | |||
+ | bool NeedsDrawFromParent { get; set; } | ||
+ | |||
+ | bool Transparent { get; set; } | ||
+ | |||
+ | bool ShadowBoxLod { get; set; } | ||
+ | |||
+ | bool SkipIfTooSmall { get; set; } | ||
+ | |||
+ | float? Scale { get; set; } | ||
+ | |||
+ | bool Visible { get; set; } | ||
+ | |||
+ | bool Save { get; set; } | ||
+ | |||
+ | MyPersistentEntityFlags2 PersistentFlags { get; set; } | ||
+ | |||
+ | bool InScene { get; } | ||
+ | |||
+ | bool InvalidateOnMove { get; } | ||
+ | |||
+ | bool IsCCDForProjectiles { get; } | ||
+ | |||
+ | bool IsVolumetric { get; } | ||
+ | |||
+ | BoundingBox LocalAABB { get; set; } | ||
+ | |||
+ | BoundingBox LocalAABBHr { get; } | ||
+ | |||
+ | Matrix LocalMatrix { get; set; } | ||
+ | |||
+ | BoundingSphere LocalVolume { get; set; } | ||
+ | |||
+ | Vector3 LocalVolumeOffset { get; set; } | ||
+ | |||
+ | Vector3 LocationForHudMarker { get; } | ||
+ | |||
+ | BoundingBox WorldAABB { get; } | ||
+ | |||
+ | BoundingBox WorldAABBHr { get; } | ||
+ | |||
+ | Matrix WorldMatrix { get; set; } | ||
+ | |||
+ | Matrix WorldMatrixInvScaled { get; } | ||
+ | |||
+ | Matrix WorldMatrixNormalizedInv { get; } | ||
+ | |||
+ | BoundingSphere WorldVolume { get; } | ||
+ | |||
+ | BoundingSphere WorldVolumeHr { get; } | ||
+ | |||
+ | event Action<IMyEntity> OnClose; | ||
+ | |||
+ | event Action<IMyEntity> OnClosing; | ||
+ | |||
+ | event Action<IMyEntity> OnMarkForClose; | ||
+ | |||
+ | event Action<IMyEntity> OnPhysicsChanged; | ||
+ | |||
+ | event Action<IMyEntity> OnPositionChanged; | ||
+ | |||
+ | string GetFriendlyName(); | ||
+ | |||
+ | void MarkForClose(); | ||
+ | |||
+ | void Close(); | ||
+ | |||
+ | IMyEntity GetTopMostParent(Type type = null); | ||
+ | |||
+ | Vector3 GetDiffuseColor(); | ||
+ | |||
+ | float GetDistanceBetweenCameraAndBoundingSphere(); | ||
+ | |||
+ | float GetDistanceBetweenCameraAndPosition(); | ||
+ | |||
+ | float GetLargestDistanceBetweenCameraAndBoundingSphere(); | ||
+ | |||
+ | float GetSmallestDistanceBetweenCameraAndBoundingSphere(); | ||
+ | |||
+ | Vector3? GetIntersectionWithLineAndBoundingSphere(ref Line line, float boundingSphereRadiusMultiplier); | ||
+ | |||
+ | bool GetIntersectionWithSphere(ref BoundingSphere sphere); | ||
+ | |||
+ | void GetTrianglesIntersectingSphere(ref BoundingSphere sphere, Vector3? referenceNormalVector, float? maxAngle, List<MyTriangle_Vertex_Normals> retTriangles, int maxNeighbourTriangles); | ||
+ | |||
+ | bool DoOverlapSphereTest(float sphereRadius, Vector3 spherePos); | ||
+ | |||
+ | MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false); | ||
+ | |||
+ | bool IsSelectable(); | ||
+ | |||
+ | bool IsSelectableAsChild(); | ||
+ | |||
+ | bool IsSelectableParentOnly(); | ||
+ | |||
+ | bool IsVisible(); | ||
+ | |||
+ | Matrix GetViewMatrix(); | ||
+ | |||
+ | Matrix GetWorldMatrixForDraw(); | ||
+ | |||
+ | Matrix GetWorldMatrixNormalizedInv(); | ||
+ | |||
+ | void SetLocalMatrix(Matrix localMatrix, object source = null); | ||
+ | |||
+ | void SetWorldMatrix(Matrix worldMatrix, object source = null); | ||
+ | |||
+ | Vector3 GetPosition(); | ||
+ | |||
+ | void SetPosition(Vector3 pos); | ||
+ | |||
+ | void GetChildren(List<IMyEntity> children, Func<IMyEntity, bool> collect = null); | ||
+ | } | ||
+ | } | ||
+ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 07:26, 28 September 2014
Contents
Interface
public interface IMyEntity
- Member of ModAPI
- Raw file API:Sandbox/ModAPI/IMyEntity/raw
- Methods
void GetChildren(System.Collections.Generic.List`1[Sandbox.ModAPI.IMyEntity], System.Func`2[Sandbox.ModAPI.IMyEntity,System.Boolean])
void GetTrianglesIntersectingSphere(VRageMath.BoundingSphere&, System.Nullable`1[VRageMath.Vector3], System.Int32)
Usage
Examples
using Sandbox.Common;
using Sandbox.Common.Components;
using Sandbox.Common.ObjectBuilders;
using System;
using System.Collections.Generic;
using VRageMath;
namespace Sandbox.ModAPI
{
public interface IMyEntity
{
long EntityId { get; set; }
string Name { get; }
string DisplayName { get; set; }
bool MarkedForClose { get; }
bool Closed { get; }
MyGameLogicComponent GameLogic { get; set; }
MyEntityUpdateEnum NeedsUpdate { get; set; }
IMyEntity Parent { get; }
bool NearFlag { get; set; }
bool CastShadows { get; set; }
bool FastCastShadowResolve { get; set; }
bool NeedsResolveCastShadow { get; set; }
float MaxGlassDistSq { get; }
bool NeedsDraw { get; set; }
bool NeedsDrawFromParent { get; set; }
bool Transparent { get; set; }
bool ShadowBoxLod { get; set; }
bool SkipIfTooSmall { get; set; }
float? Scale { get; set; }
bool Visible { get; set; }
bool Save { get; set; }
MyPersistentEntityFlags2 PersistentFlags { get; set; }
bool InScene { get; }
bool InvalidateOnMove { get; }
bool IsCCDForProjectiles { get; }
bool IsVolumetric { get; }
BoundingBox LocalAABB { get; set; }
BoundingBox LocalAABBHr { get; }
Matrix LocalMatrix { get; set; }
BoundingSphere LocalVolume { get; set; }
Vector3 LocalVolumeOffset { get; set; }
Vector3 LocationForHudMarker { get; }
BoundingBox WorldAABB { get; }
BoundingBox WorldAABBHr { get; }
Matrix WorldMatrix { get; set; }
Matrix WorldMatrixInvScaled { get; }
Matrix WorldMatrixNormalizedInv { get; }
BoundingSphere WorldVolume { get; }
BoundingSphere WorldVolumeHr { get; }
event Action<IMyEntity> OnClose;
event Action<IMyEntity> OnClosing;
event Action<IMyEntity> OnMarkForClose;
event Action<IMyEntity> OnPhysicsChanged;
event Action<IMyEntity> OnPositionChanged;
string GetFriendlyName();
void MarkForClose();
void Close();
IMyEntity GetTopMostParent(Type type = null);
Vector3 GetDiffuseColor();
float GetDistanceBetweenCameraAndBoundingSphere();
float GetDistanceBetweenCameraAndPosition();
float GetLargestDistanceBetweenCameraAndBoundingSphere();
float GetSmallestDistanceBetweenCameraAndBoundingSphere();
Vector3? GetIntersectionWithLineAndBoundingSphere(ref Line line, float boundingSphereRadiusMultiplier);
bool GetIntersectionWithSphere(ref BoundingSphere sphere);
void GetTrianglesIntersectingSphere(ref BoundingSphere sphere, Vector3? referenceNormalVector, float? maxAngle, List<MyTriangle_Vertex_Normals> retTriangles, int maxNeighbourTriangles);
bool DoOverlapSphereTest(float sphereRadius, Vector3 spherePos);
MyObjectBuilder_EntityBase GetObjectBuilder(bool copy = false);
bool IsSelectable();
bool IsSelectableAsChild();
bool IsSelectableParentOnly();
bool IsVisible();
Matrix GetViewMatrix();
Matrix GetWorldMatrixForDraw();
Matrix GetWorldMatrixNormalizedInv();
void SetLocalMatrix(Matrix localMatrix, object source = null);
void SetWorldMatrix(Matrix worldMatrix, object source = null);
Vector3 GetPosition();
void SetPosition(Vector3 pos);
void GetChildren(List<IMyEntity> children, Func<IMyEntity, bool> collect = null);
}
}