本文整理汇总了C#中Sandbox.OnAddedToScene方法的典型用法代码示例。如果您正苦于以下问题:C# Sandbox.OnAddedToScene方法的具体用法?C# Sandbox.OnAddedToScene怎么用?C# Sandbox.OnAddedToScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox
的用法示例。
在下文中一共展示了Sandbox.OnAddedToScene方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddChildWithMatrix
public void AddChildWithMatrix(Sandbox.ModAPI.IMyEntity child, ref Matrix childLocalMatrix, bool insertIntoSceneIfNeeded = true)
{
child.Hierarchy.Parent = this;
Children.Add(child.Hierarchy);
child.WorldMatrix = (MatrixD)childLocalMatrix * Entity.PositionComp.WorldMatrix;
if (Entity.InScene && !child.InScene && insertIntoSceneIfNeeded)
child.OnAddedToScene(this);
}
示例2: AddChild
/// <summary>
/// Adds the child.
/// </summary>
/// <param name="child">The child.</param>
/// <param name="preserveWorldPos">if set to <c>true</c> [preserve absolute position].</param>
public void AddChild(Sandbox.ModAPI.IMyEntity child, bool preserveWorldPos = false, bool insertIntoSceneIfNeeded = true)
{
//MyEntities.Remove(child); // if it's already in the world, remove it
child.Hierarchy.Parent = this;
if (preserveWorldPos)
{
var tmpWorldMatrix = child.WorldMatrix;
this.Children.Add(child.Hierarchy);
child.WorldMatrix = tmpWorldMatrix;
}
else
{
this.Children.Add(child.Hierarchy);
var m = Entity.PositionComp.WorldMatrix;
child.PositionComp.UpdateWorldMatrix(ref m);
}
if (Entity.InScene && !child.InScene && insertIntoSceneIfNeeded)
child.OnAddedToScene(this.Entity);
}