void Awake()
 {
     // Get both of the components we need to do this
     raycaster = GetComponent <GraphicRaycaster>();
     _inputs   = new InputMasterCompSys();
     _inputs.KV.Enable();
     _inputs.KV.DeleteExpression.performed += Testitest;
 }
Exemple #2
0
 /**
  * Activates Input-behaviour depending on the current Game-Mode.
  * The Input-Actionmap must contain all needed entrys and all methods used on these actions must be added to the corresponding event.
  * Actionmap GateBuilder contains the ACtion ClickAction, which triggers on left-mouse-button click.
  * On this Action, the Method PlaceSelected will be added, to be invoked on the ClickAction-Event.
  * The GateBuilder-Actionmap will be activated, if the current Gamemode (GameInputType) is GateBuilder.
  */
 private void SetFunctions()
 {
     // Get a Inputmaster, if there is none.
     if (_inputs == null)
     {
         _inputs = new InputMasterCompSys();
     }
     // Reset the selected ScriptableObjectVariable to avoid errors by placing gridelements from the wrong scenes into the current.
     selected.go = null;
     if (_currentGIT == GameInputType.GateBuilder)
     {
         _inputs.Gatebuilder.Enable();
         _inputs.Gatebuilder.ClickAction.performed  += PlaceSelected;
         _inputs.Gatebuilder.Rotate.performed       += RotateSelected;
         _inputs.Gatebuilder.ChangeCharge.performed += ChangeCTCharge;
         _inputs.Gatebuilder.Cancel.performed       += Cancel;
     }
     if (_currentGIT == GameInputType.KV)
     {
         _inputs.KV.Enable();
         _inputs.KV.SetElement.performed += SetElement;
         _inputs.KV.Cancel.performed     += Cancel;
     }
     if (_currentGIT == GameInputType.None)
     {
         _inputs.KV.Enable();
         _inputs.KV.Cancel.performed += Cancel;
     }
     if (_currentGIT == GameInputType.Menu)
     {
         _inputs.Gatebuilder.Enable();
         _inputs.Gatebuilder.Cancel.performed += EndGame;
     }
     if (_currentGIT == GameInputType.Plotter)
     {
         _inputs.Schaltnetz.Enable();
         _inputs.Schaltnetz.Cancel.performed          += Cancel;
         _inputs.Schaltnetz.MoveCamera.performed      += MoveCamera;
         _inputs.Schaltnetz.ClickAction.performed     += LeftClickPC;
         _inputs.Schaltnetz.Scroll.performed          += ScrollMouse;
         _inputs.Schaltnetz.PreviewBuilding.performed += PreviewOnLocation;
         _inputs.Schaltnetz.Remove.performed          += Remove;
         _inputs.Schaltnetz.StopClickAction.performed += StopPlacing;
         _inputs.Schaltnetz.StopRemove.performed      += StopRemoving;
     }
     if (_currentGIT == GameInputType.DecimalEncoder)
     {
         _inputs.DecimalEncoder.Enable();
         _inputs.DecimalEncoder.MoveCamera.performed   += RotateCamera;
         _inputs.DecimalEncoder.Movement.performed     += MovePlayer;
         _inputs.DecimalEncoder.RotatePlayer.performed += RotatePlayer;
         _inputs.DecimalEncoder.Activate.performed     += Activate;
         _inputs.DecimalEncoder.Cancel.performed       += Cancel;
     }
 }