FrameIT
Gadget Class Reference

Base class for all Gadgets to derive from. A Gadget is a tool for the player (and level editor) to interact with the GameWorld. More...

Inheritance diagram for Gadget:
AngleTool EqualCircleGadget Gadget.UndefinedGadget LineTool LotTool Pendulum Pointer PoleTool Remover Tape TestMiddlePoint

Classes

class  UndefinedGadget
 

Public Types

enum  GadgetIDs {
  Unused = -3 , Undefined = -1 , Pointer = 0 , Tape = 1 ,
  AngleTool = 2 , LineTool = 3 , LotTool = 4 , Pendulum = 5 ,
  PoleTool = 6 , Remover = 7 , EqualCircles = 8 , MiddlePoint = 9
}
 Used to map to a T:Gadget More...
 

Public Member Functions

 Gadget ()
 
void Init (bool overrite)
 
void Awake ()
 
void Enable ()
 
void Disable ()
 
void Update ()
 
void Hit (RaycastHit[] hit)
 
void ResetGadget ()
 

Static Public Member Functions

static bool Equals (Gadget a, Gadget b)
 

Public Attributes

int Rank = int.MinValue
 Position in tool belt. More...
 
string UiName = null
 Tool Name More...
 
float MaxRange = float.NegativeInfinity
 Maximum range for this Tool. For consistency use GadgetDistances in GlobalBehaviour. More...
 
float MaxHeight = float.NegativeInfinity
 
int ButtonIndx = -1
 Which sprite to use More...
 
int MaterialIndx = -1
 
LayerMask LayerHitMask = -1
 Layers to ignore for this gadget by default. More...
 
LayerMask SecondaryLayerMask = -1
 
List< string > Workflow = new()
 Keeps track of selected Fact.Ids the Gadget used to produce a single Fact. More...
 

Static Public Attributes

static Dictionary< Type, GadgetIDsGadgetTypeToIDs
 
static readonly IEnumerable< Type > GadgetTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => t != typeof(Gadget) && typeof(Gadget).IsAssignableFrom(t))
 Collection of Types of all available Gadgets to choose from. More...
 

Protected Member Functions

virtual void _Awake ()
 
virtual void _Enable ()
 
virtual void _Disable ()
 
virtual void _Update ()
 
virtual void _Hit (RaycastHit[] hit)
 Called when CommunicationEvents.TriggerEvent is invoked, a.k.a. when Player clicks in GameWorld. More...
 
void ActivateLineDrawing ()
 
void DeactivateLineDrawing ()
 
void UpdateLineDrawing ()
 
virtual void _ActivateLineDrawing ()
 
virtual void _DeactivateLineDrawing ()
 
virtual void _UpdateLineDrawing ()
 
Vector3 GetPosition (int i)
 
void SetPosition (int i, Vector3 v)
 
void SetPositions (Vector3[] v)
 
virtual void _ResetGadget ()
 
virtual void _Update_Range ()
 

Static Protected Attributes

static string s_type = "ERROR: set s_type in T:Gadget"
 

Private Attributes

bool init_success = false
 

Detailed Description

Base class for all Gadgets to derive from. A Gadget is a tool for the player (and level editor) to interact with the GameWorld.

Member Enumeration Documentation

◆ GadgetIDs

Used to map to a T:Gadget

Do NOT rename elements! Do NOT change values! Deserialization relies on it!

Enumerator
Unused 
Undefined 
Pointer 
Tape 
AngleTool 
LineTool 
LotTool 
Pendulum 
PoleTool 
Remover 
EqualCircles 
MiddlePoint 

Constructor & Destructor Documentation

◆ Gadget()

Gadget.Gadget ( )

Member Function Documentation

◆ _ActivateLineDrawing()

virtual void Gadget._ActivateLineDrawing ( )
protectedvirtual

◆ _Awake()

virtual void Gadget._Awake ( )
protectedvirtual

◆ _DeactivateLineDrawing()

virtual void Gadget._DeactivateLineDrawing ( )
protectedvirtual

◆ _Disable()

virtual void Gadget._Disable ( )
protectedvirtual

◆ _Enable()

virtual void Gadget._Enable ( )
protectedvirtual

Reimplemented in Pendulum, and PoleTool.

◆ _Hit()

virtual void Gadget._Hit ( RaycastHit[]  hit)
protectedvirtual

Called when CommunicationEvents.TriggerEvent is invoked, a.k.a. when Player clicks in GameWorld.

Parameters
hitthe position where it was clicked

Reimplemented in AngleTool, EqualCircleGadget, LineTool, LotTool, Pendulum, Pointer, PoleTool, Remover, Tape, and TestMiddlePoint.

◆ _ResetGadget()

virtual void Gadget._ResetGadget ( )
protectedvirtual

◆ _Update()

virtual void Gadget._Update ( )
protectedvirtual

◆ _Update_Range()

virtual void Gadget._Update_Range ( )
protectedvirtual

◆ _UpdateLineDrawing()

virtual void Gadget._UpdateLineDrawing ( )
protectedvirtual

◆ ActivateLineDrawing()

void Gadget.ActivateLineDrawing ( )
protected

◆ Awake()

void Gadget.Awake ( )

◆ DeactivateLineDrawing()

void Gadget.DeactivateLineDrawing ( )
protected

◆ Disable()

void Gadget.Disable ( )

◆ Enable()

void Gadget.Enable ( )

◆ Equals()

static bool Gadget.Equals ( Gadget  a,
Gadget  b 
)
static

◆ GetPosition()

Vector3 Gadget.GetPosition ( int  i)
protected

◆ Hit()

void Gadget.Hit ( RaycastHit[]  hit)

◆ Init()

void Gadget.Init ( bool  overrite)

◆ ResetGadget()

void Gadget.ResetGadget ( )

◆ SetPosition()

void Gadget.SetPosition ( int  i,
Vector3  v 
)
protected

◆ SetPositions()

void Gadget.SetPositions ( Vector3[]  v)
protected

◆ Update()

void Gadget.Update ( )

◆ UpdateLineDrawing()

void Gadget.UpdateLineDrawing ( )
protected

Member Data Documentation

◆ ButtonIndx

int Gadget.ButtonIndx = -1

Which sprite to use

◆ GadgetTypes

readonly IEnumerable<Type> Gadget.GadgetTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => t != typeof(Gadget) && typeof(Gadget).IsAssignableFrom(t))
static

Collection of Types of all available Gadgets to choose from.

◆ GadgetTypeToIDs

Dictionary<Type, GadgetIDs> Gadget.GadgetTypeToIDs
static
Initial value:
= new(){
{typeof(UndefinedGadget) , GadgetIDs.Undefined },
{typeof(Pointer) , GadgetIDs.Pointer },
{typeof(Tape) , GadgetIDs.Tape },
{typeof(AngleTool) , GadgetIDs.AngleTool },
{typeof(LineTool) , GadgetIDs.LineTool },
{typeof(LotTool) , GadgetIDs.LotTool },
{typeof(Pendulum) , GadgetIDs.Pendulum },
{typeof(PoleTool) , GadgetIDs.PoleTool },
{typeof(Remover) , GadgetIDs.Remover },
{typeof(EqualCircleGadget) , GadgetIDs.EqualCircles },
{typeof(TestMiddlePoint) , GadgetIDs.MiddlePoint },
}
Definition: AngleTool.cs:5
a Gadget that checks whether two given circles have equal size and if yes it returns an EqualCirclesF...
Definition: EqualCircleGadget.cs:7
GadgetIDs
Used to map to a T:Gadget
Definition: Gadget.cs:37
Definition: LineTool.cs:5
Definition: LotTool.cs:6
Definition: Pendulum.cs:5
Definition: Pointer.cs:4
Definition: PoleTool.cs:5
Definition: Remover.cs:5
Definition: Tape.cs:4
Definition: TestMiddlePoint.cs:4

◆ init_success

bool Gadget.init_success = false
private

◆ LayerHitMask

LayerMask Gadget.LayerHitMask = -1

Layers to ignore for this gadget by default.

Set in Inspector

◆ MaterialIndx

int Gadget.MaterialIndx = -1

◆ MaxHeight

float Gadget.MaxHeight = float.NegativeInfinity

◆ MaxRange

float Gadget.MaxRange = float.NegativeInfinity

Maximum range for this Tool. For consistency use GadgetDistances in GlobalBehaviour.

Set in Inspector or Awake

◆ Rank

int Gadget.Rank = int.MinValue

Position in tool belt.

Set in Inspector or Awake

◆ s_type

string Gadget.s_type = "ERROR: set s_type in T:Gadget"
staticprotected

[ClassName] for JSON de-/serialization. Set in every non-abstract subclass of Gadget. Also add JsonSubtypes.KnownSubType attribute for deserialization to Gadget!

◆ SecondaryLayerMask

LayerMask Gadget.SecondaryLayerMask = -1

◆ UiName

string Gadget.UiName = null

Tool Name

Set in Inspector or Awake

◆ Workflow

List<string> Gadget.Workflow = new()

Keeps track of selected Fact.Ids the Gadget used to produce a single Fact.


The documentation for this class was generated from the following file: