Placing

An alternative to using the events is to use a custom class derived from the Placing class and then using the virtual methods in there to even more info about which elements are being placed. To use this system you need to make your own class that is derived from the Place class and then override the methods you need to use. Then in the Artificer inspector add the object the class is on to the Placing field in the Build Options section of the inspector. The methods will then be called when an element in the Parts to Call Place event list is in its final position

Placing Class

using UnityEngine;

namespace Artifice
{
	public class Placing : MonoBehaviour
	{
		public virtual void PlacingElement(MeshElement me, int index, Matrix4x4 tm, float alpha) {}

		public virtual void PlacedElement(MeshElement me, int index, Matrix4x4 tm) { }

		public virtual void StartingElement(MeshElement me, int index, Matrix4x4 tm)	{	}
	}
}

PlacingElement

This called when an element is moving into position.

me - The element being positioned

index - The id of the element being positioned

tm - The elements current transform matrix, you can get the position from this.

alpha - How far through its assembly animation this element is 0 is just starting 1 is fully built.

PlacedElement

This called when an element is at its final assmebly position.

me - The element being positioned

index - The id of the element being positioned

tm - The elements current transform matrix, you can get the position from this.

StartingElement

This called when the element is just starting its assembly animation.

me - The element being positioned

index - The id of the element being positioned

tm - The elements current transform matrix, you can get the position from this.

Example Usage

This is a simple example of the use of the Placing class. This example will emit a particle from elements as they are positioned.

Last updated