public override Instance Clone(InstanceState instanceState, ref Matrix4x4 matrix4x, float deltaHeight, float deltaAngle, Vector3 center, bool followTerrain, Dictionary <ushort, ushort> clonedNodes, Action action) { PropState state = instanceState as PropState; Vector3 newPosition = matrix4x.MultiplyPoint(state.position - center); newPosition.y = state.position.y + deltaHeight; if (followTerrain) { newPosition.y = newPosition.y + TerrainManager.instance.SampleOriginalRawHeightSmooth(newPosition) - state.terrainHeight; } Instance cloneInstance = null; PropInstance[] buffer = PropManager.instance.m_props.m_buffer; if (PropManager.instance.CreateProp(out ushort clone, ref SimulationManager.instance.m_randomizer, state.Info.Prefab as PropInfo, newPosition, state.angle + deltaAngle, state.single)) { InstanceID cloneID = default; cloneID.Prop = clone; buffer[clone].FixedHeight = state.fixedHeight; cloneInstance = new MoveableProp(cloneID); } return(cloneInstance); }
public override Instance Clone(InstanceState instanceState, Dictionary <ushort, ushort> clonedNodes) { PropState state = instanceState as PropState; Instance cloneInstance = null; if (PropLayer.Manager.CreateProp(out uint clone, state.Info.Prefab as PropInfo, state.position, state.angle, state.single)) { InstanceID cloneID = default; cloneID = PropLayer.Manager.SetProp(cloneID, clone); cloneInstance = new MoveableProp(cloneID); } return(cloneInstance); }
public override Instance Clone(InstanceState instanceState, Dictionary <ushort, ushort> clonedNodes) { PropState state = instanceState as PropState; Instance cloneInstance = null; if (PropManager.instance.CreateProp(out ushort clone, ref SimulationManager.instance.m_randomizer, state.Info.Prefab as PropInfo, state.position, state.angle, state.single)) { InstanceID cloneID = default; cloneID.Prop = clone; cloneInstance = new MoveableProp(cloneID); } return(cloneInstance); }