Utilities/Prefab Manager¶

Summary¶

namespace MAGES::Utilities

namespace MAGES::Utilities::prefabSpawnManager

namespace MAGES::Utilities::prefabSpawnNotifier

class HologramPrefabBehavior

class PathAnimation

class PrefabLerpPlacement When an interactable gameObject needs to be placed somewhere with a correct angle, it is difficult to measure if it’s correctly placed because we do not have something to compare it to. A solution is to have the same gameObject duplicated and have this script attached to it.

class QuestionTriggerCollider

class ToolTriggerCollider This script is attached to every child of the prefab that contains the ToolColliderPrefabConstructor Everytime each child is triggered it calls the parent when it’s done via this script

namespace MAGES::Utilities¶

Summary¶

class MAGES::Utilities::OnDestoyCallBackForFakePrefabs

class MAGES::Utilities::PrefabImporter Prefab Importer is a helper class that loads and instantiates prefabs

class MAGES::Utilities::OnDestoyCallBackForFakePrefabs¶

class MAGES::Utilities::OnDestoyCallBackForFakePrefabs
: public MonoBehaviour


Summary¶

public Action onDestoy

class MAGES::Utilities::PrefabImporter¶

class MAGES::Utilities::PrefabImporter
: public MonoBehaviour


Prefab Importer is a helper class that loads and instantiates prefabs

namespace MAGES::Utilities::prefabSpawnManager¶

Summary¶

class MAGES::Utilities::prefabSpawnManager::PrefabSpawnManager Many gameobjects have physics properties (e.g. gravity). So there can be cases when the physics engine bugs and the object disappears or a user making a mistake, and have the object being thrown to an unreachable spot.

class MAGES::Utilities::prefabSpawnManager::PrefabSpawnManager¶

class MAGES::Utilities::prefabSpawnManager::PrefabSpawnManager
: public MonoBehaviour


Many gameobjects have physics properties (e.g. gravity). So there can be cases when the physics engine bugs and the object disappears or a user making a mistake, and have the object being thrown to an unreachable spot.

This script purpose is to store each interactable -with physics properties- gameobject and observe its behavior. It constantly observes each gameObject per some seconds and resets it under specific conditions such as: i. not beng attached by anything (using the MAGESInteractableItem script) ii. being away from it’s starting position by a given offset. This offset can be set from the gameObject itself if it has attached the script InteractablePrefabCostructor OR InteractableWithParentPrefabConstructor.

PrefabSpawnManager is also responsible for preloading all prefabs on start of the Application

NOTICE Every function of this class can be used for debug purposes. However since evey function is called internally they SHOULD NOT be called from the developers.

This sigleton contains a unity function Update()

Summary¶

{property} PrefabSpawnManager Pm_inst

public bool preLoadAssets

class MAGES::Utilities::prefabSpawnManager::PrefabSpawnManager::PrefabSpawnValues¶

Summary¶

public GameObject spawnedPrefab

public InteractablePrefabConstructor spawnedPrefabConstructor

public Coroutine spawnedPrefabCoroutine

public inline  PrefabSpawnValues(GameObject _gameObject)

namespace MAGES::Utilities::prefabSpawnNotifier¶

Summary¶

class MAGES::Utilities::prefabSpawnNotifier::PrefabSpawnNotifier Script is responsible for flashing the gameobject it’s attached to. Helpful for the user to notice specific gameobject. When attached to one, the gameobject will automatically start flashing. If it contains colliders, then when the users hand (ONLY if it’s tagged “RightPalm” and/or “LeftPalm”) is hovering above the gameObject it will flash faster with another to notify the user that it is in a grabbable range (if selected).

class MAGES::Utilities::prefabSpawnNotifier::PrefabSpawnNotifier¶

class MAGES::Utilities::prefabSpawnNotifier::PrefabSpawnNotifier
: public MonoBehaviour


Script is responsible for flashing the gameobject it’s attached to. Helpful for the user to notice specific gameobject. When attached to one, the gameobject will automatically start flashing. If it contains colliders, then when the users hand (ONLY if it’s tagged “RightPalm” and/or “LeftPalm”) is hovering above the gameObject it will flash faster with another to notify the user that it is in a grabbable range (if selected).

When grabbed from the user, OR the StopNotification Function is called, the gameObject stops flashing and the script gets destoryed.

The public values are only viable to change for the Inital Setup, before the script rins (e.g. setup on Editor).

NOTICE It may NOT work for all types of shaders.

Summary¶

public Color mainFlashColor

public bool allowDifferentColorOnHover

public Color hoverColor

public float mainFlashSpeedMul

public float hoverFlashSpeedMul

public inline void StopNotification() resets the material of the gameObject, stops the flashing and the script is auto-destoryed

Members¶

public inline void StopNotification()¶

resets the material of the gameObject, stops the flashing and the script is auto-destoryed

class HologramPrefabBehavior¶

class HologramPrefabBehavior
: public MonoBehaviour


class PathAnimation¶

class PathAnimation
: public MonoBehaviour


Summary¶

public bool conditionsAreMet

public inline void SetUpPathAnimation(string animName,GameObject startTransform,GameObject endTransform,float targetProgress,int animationLayer,bool reverseAnimation,bool lateStart)

public inline void Initialize()

public inline void FinalizeScript()

public inline float GetAnimationValue()

public inline void ManualStartAnimation()

public inline void RecalculateTotalDistance()

class PrefabLerpPlacement¶

class PrefabLerpPlacement
: public MonoBehaviour


When an interactable gameObject needs to be placed somewhere with a correct angle, it is difficult to measure if it’s correctly placed because we do not have something to compare it to. A solution is to have the same gameObject duplicated and have this script attached to it.

The gameObject with this script must be placed to its final -placed- position. When started, the renderers for this gameObject will be disabled. When the other gameObject (the similar one!) collides with this gameObect, it observes their angle difference. When this difference is below the offset given from the developer, this scirpt detaches the gameObect from anywhere that it is attached using the script ‘MAGESInteractableItem’ and adjust its to position and rotation to match the ones of this -final-gameObject. After the Lerping time (or adjustment time) is finished, the other gameObject gets destroyed, this gameObject’s renderers are enabled and every other behavior provided to this gameObject is executed (e.g. an animation). In the end the script auto disables itself.

REQUIREMENTS:* Both must have rigidbodies and colliders

• The other gameobject must contain in it’s parent the MAGESInteractableItem or MAGESInteractableRotator script.

• If this gameObject has an animation, it must be an Animation Component NOT an Animator and the animation iself must be Legacy Supported (see debug option)

Summary¶

public float maxAngleDegreeDiff

public float acceptedAngle

public List< GameObject > InteractablePrefabs

public inline void FinalizePrefabAction() If the action was skipped and the prefab that has attached this script isn’t in the state where it should be if the user whould do the whole action correctly, call this function on the action’s Perform function to turn this prefab into it’s final state

public inline void FinalizePrefabActionByNetWork() When server or client finishes the action, the prefab goes to its final state ONLY when the game is in online mode!

Members¶

public List< GameObject > InteractablePrefabs¶

public inline void FinalizePrefabAction()¶

If the action was skipped and the prefab that has attached this script isn’t in the state where it should be if the user whould do the whole action correctly, call this function on the action’s Perform function to turn this prefab into it’s final state

public inline void FinalizePrefabActionByNetWork()¶

When server or client finishes the action, the prefab goes to its final state ONLY when the game is in online mode!

NOTICE This function should not be called manually. it’s internal function (between dlls)

class QuestionTriggerCollider¶

class QuestionTriggerCollider
: public MonoBehaviour


Summary¶

public bool m_IsCorrect

public inline void ActionCall()

public inline void SetOnFinishSend(Action a) Internally used function Set the callback when the collider is finished

Members¶

public inline void SetOnFinishSend(Action a)¶

Internally used function Set the callback when the collider is finished

Parameters¶

• a

class ToolTriggerCollider¶

class ToolTriggerCollider
: public MonoBehaviour


This script is attached to every child of the prefab that contains the ToolColliderPrefabConstructor Everytime each child is triggered it calls the parent when it’s done via this script

If the parent has the ToolColliderPrefabConstructor script it automatically attaches this script to every 1st depth child

REQUIREMENTS: each child must have a trigger collider

Summary¶

public inline void SetUsedTool(List< ToolAndTime > _usedTools) Provide at runtime a new tool that can complete this action and the time it will need to trigger every collider

public inline void SetOnFinishSend(Action a) Internally used function Set the callback when the collider is finished

Members¶

public inline void SetUsedTool(List< ToolAndTime > _usedTools)¶

Provide at runtime a new tool that can complete this action and the time it will need to trigger every collider

Parameters¶

• _usedTools List of class that contains the tool and a float for the collider’s trigger timer

public inline void SetOnFinishSend(Action a)¶

Internally used function Set the callback when the collider is finished

Parameters¶

• a