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,
        bool disableOnHover = true
    );

    static bool ShouldGhostBeOn(GameObject gameObject);
    Ghost Overlay(bool overlay);
    Ghost EnableInStart(bool enableInStart);
    Ghost Color(Color color);
    Ghost Animation(RuntimeAnimatorController controller);
    Ghost DisableOnHover(bool disableOnHover);
    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,
    bool disableOnHover = 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.

disableOnHover

Whether the hologram should be disabled on hover.

Returns:

The instance of the hologram.

static bool ShouldGhostBeOn(GameObject gameObject)

Returns whether or not the ghost effect should be on or off.

Parameters:

gameObject

The gameobject that the ghost effect will be applied on.

Returns:

True if the ghost effect should be on.

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.

Ghost DisableOnHover(bool disableOnHover)

Sets the hologram to be disabled on hover.

Parameters:

disableOnHover

True to disable on hover, False to not disable on hover.

Returns:

Self.

void SetOn(bool on)

Sets the hologram on or off.

Parameters:

on

True for on, False for off.