class MAGES::Ghost

Overview

A ghost is a 3D object that is used to display spatial information, like where an object is, or where it should go. More…

class Ghost: public MonoBehaviour
{
public:
    // classes

    class Data;
    class SavedObjectState;

    // properties

    Data Theme;
    bool IsOn;

    // methods

    static Ghost Spawn(
        GameObject gameObject,
        Data data,
        bool overlay,
        bool on = true
    );

    Ghost Overlay(bool overlay);
    Ghost EnableInStart(bool enableInStart);
    Ghost Color(Color color);
    Ghost Animation(RuntimeAnimatorController controller);
    void SetOn(bool on);
};

Detailed Documentation

A ghost is a 3D object that is used to display spatial information, like where an object is, or where it should go.

This class will do the following:

When On: 1. Replace the materials on the object’s hierarchy with ghost material instances. 2. Add/Modify currently existing animators to use the ghost animator controller;

When Off: 1. Restore the materials on the object’s hierarchy to their original values. 2. Restore the animators to their original values.

When Ghost.overlay mode is on, the materials will be replaced with instances of the ghost material, and the main texture will be set to the original material’s main texture.

Properties

Data Theme

Gets or sets the data for the hologram.

bool IsOn

Gets a value indicating whether the hologram is in overlay mode.

Methods

static Ghost Spawn(
    GameObject gameObject,
    Data data,
    bool overlay,
    bool on = true
)

Spawns a hologram on the given game object.

Parameters:

gameObject

The gameobject to turn into a hologram.

data

The instance data of the hologram.

overlay

Whether the hologram is in overlay mode.

on

Whether the hologram is on.

Returns:

The instance of the hologram.

Ghost Overlay(bool overlay)

Sets the hologram overlay mode.

Parameters:

overlay

Whether or not overlay mode should be on.

Returns:

Self.

Ghost EnableInStart(bool enableInStart)

Sets whether the hologram should be enabled when Start() is called.

Parameters:

enableInStart

Set to true to enable automatic setup at Start.

Returns:

Self.

Ghost Color(Color color)

Overrides the hologram’s color.

Parameters:

color

The new color.

Returns:

Self.

Ghost Animation(RuntimeAnimatorController controller)

Overrides the hologram’s animator controller.

Parameters:

controller

The new controller.

Returns:

Self.

void SetOn(bool on)

Sets the hologram on or off.

Parameters:

on

True for on, False for off.