private void OnDestroy() { if (InputManager.HasInstance) { InputManager.Instance.Controls.game.pause.performed -= OnPause; InputManager.Instance.Controls.game.moveforward.started -= OnMoveForward; InputManager.Instance.Controls.game.moveforward.performed -= OnMoveForwardStop; InputManager.Instance.Controls.game.movebackward.started -= OnMoveBackward; InputManager.Instance.Controls.game.movebackward.performed -= OnMoveBackwardStop; InputManager.Instance.Controls.game.moveleft.started -= OnMoveLeft; InputManager.Instance.Controls.game.moveleft.performed -= OnMoveLeftStop; InputManager.Instance.Controls.game.moveright.started -= OnMoveRight; InputManager.Instance.Controls.game.moveright.performed -= OnMoveRightStop; InputManager.Instance.Controls.game.jump.started -= OnMoveUp; InputManager.Instance.Controls.game.jump.performed -= OnMoveUpStop; InputManager.Instance.Controls.game.movedown.started -= OnMoveDown; InputManager.Instance.Controls.game.movedown.performed -= OnMoveDownStop; InputManager.Instance.Controls.game.look.started -= OnLook; InputManager.Instance.Controls.game.look.performed -= OnLook; InputManager.Instance.Controls.game.look.canceled -= OnLookStop; } if (ViewerManager.HasInstance) { ViewerManager.Instance.ReleaseViewer(_viewer); } _viewer = null; }
private void Awake() { FollowTarget = GetComponent <FollowTarget>(); _viewer = ViewerManager.Instance.AcquireViewer <ServerSpectatorViewer>(); if (null != _viewer) { _viewer.Initialize(this); } InputManager.Instance.Controls.game.pause.performed += OnPause; InputManager.Instance.Controls.game.moveforward.started += OnMoveForward; InputManager.Instance.Controls.game.moveforward.performed += OnMoveForwardStop; InputManager.Instance.Controls.game.movebackward.started += OnMoveBackward; InputManager.Instance.Controls.game.movebackward.performed += OnMoveBackwardStop; InputManager.Instance.Controls.game.moveleft.started += OnMoveLeft; InputManager.Instance.Controls.game.moveleft.performed += OnMoveLeftStop; InputManager.Instance.Controls.game.moveright.started += OnMoveRight; InputManager.Instance.Controls.game.moveright.performed += OnMoveRightStop; InputManager.Instance.Controls.game.jump.started += OnMoveUp; InputManager.Instance.Controls.game.jump.performed += OnMoveUpStop; InputManager.Instance.Controls.game.movedown.started += OnMoveDown; InputManager.Instance.Controls.game.movedown.performed += OnMoveDownStop; InputManager.Instance.Controls.game.look.started += OnLook; InputManager.Instance.Controls.game.look.performed += OnLook; InputManager.Instance.Controls.game.look.canceled += OnLookStop; }