public void Initialize() { //reset action events OnJump = null; OnLand = null; OnMove = null; OnStop = null; //resed boolean values _isGrounded = true; _moved = false; _isJumping = false; //reset player input key bindings input = GetComponent <PlayerInputSystem>(); CanMove = true; movement = input.Player; movement.Enable(); movement["Jump"].started += StartJump; movement["Jump"].performed += CancelJump; movement["Jump"].canceled += CancelEarly; if (gameObject.layer.Equals(LayerMask.NameToLayer("Harmony"))) { slideOffOf &= ~LayerMask.NameToLayer("HarmonyGateway"); canJumpOff |= 1 << LayerMask.NameToLayer("Chaos"); } else { slideOffOf &= ~LayerMask.NameToLayer("ChaosGateway"); canJumpOff |= 1 << LayerMask.NameToLayer("Harmony"); } settings = input.Settings; }
public void Initialize() { input = GetComponent <PlayerInputSystem>(); _ability = input.Ability; _movement = input.Player; _ability.Disable(); _movement["Interact"].Disable(); _movement["Ability"].performed += ctx => Interact(); _ability["Place"].performed += Place; _ability["Cancel"].performed += Cancel; settings = input.Settings; if (_createdObject) { Destroy(_createdObject); _createdInteraction = null; _createdObject = null; } }