protected virtual void AwakePlayerInteraction() { // Get the player interaction. if (player) { playerInteraction = player.GetComponent <GoldPlayerInteraction>(); } else if (autoFindPlayer) { playerInteraction = FindObjectOfType <GoldPlayerInteraction>(); } }
/// <summary> /// Sets the player and finds all required components. /// </summary> private void SetPlayer(GoldPlayerController player) { #if !GOLD_PLAYER_DISABLE_INTERACTION // Only get the interaction if the previous set player isn't the new player. if (player != null && this.player != player) { playerInteraction = player.GetComponent <GoldPlayerInteraction>(); } #endif // Set the player. this.player = player; }
private void Reset() { GoldPlayerController gp = GetComponent <GoldPlayerController>(); #if !GOLD_PLAYER_DISABLE_INTERACTION GoldPlayerInteraction gi = GetComponent <GoldPlayerInteraction>(); #endif // If the player controller exists, add the input action name from there, otherwise just make it generic. actions = new InputSystemItem[] { new InputSystemItem(gp != null ? gp.Camera.LookInput : "Look", null), new InputSystemItem(gp != null ? gp.Movement.MoveInput : "Move", null), new InputSystemItem(gp != null ? gp.Movement.JumpInput : "Jump", null), new InputSystemItem(gp != null ? gp.Movement.RunInput : "Run", null), new InputSystemItem(gp != null ? gp.Movement.CrouchInput : "Crouch", null), #if !GOLD_PLAYER_DISABLE_INTERACTION new InputSystemItem(gi != null ? gi.InteractInput : "Interact", null) #endif }; }