| | 1 | | using System; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | public class ExpressionsHotKeyController : MonoBehaviour |
| | 5 | | { |
| | 6 | | [Serializable] |
| | 7 | | private class ExpressionInputActionToId |
| | 8 | | { |
| | 9 | | public InputAction_Trigger inputAction; |
| | 10 | | public string id; |
| | 11 | | } |
| | 12 | |
|
| | 13 | | [SerializeField] private ExpressionInputActionToId waveExpression; |
| | 14 | | [SerializeField] private ExpressionInputActionToId robotExpression; |
| | 15 | | [SerializeField] private ExpressionInputActionToId fistpumpExpression; |
| | 16 | | [SerializeField] private ExpressionInputActionToId raiseHandExpression; |
| | 17 | | [SerializeField] private ExpressionInputActionToId clapExpression; |
| | 18 | | [SerializeField] private ExpressionInputActionToId throwMoneyExpression; |
| | 19 | | [SerializeField] private ExpressionInputActionToId sendKissExpression; |
| | 20 | |
|
| | 21 | | private InputAction_Trigger.Triggered waveDelegate; |
| | 22 | | private InputAction_Trigger.Triggered robotDelegate; |
| | 23 | | private InputAction_Trigger.Triggered fistpumpDelegate; |
| | 24 | | private InputAction_Trigger.Triggered raiseHandDelegate; |
| | 25 | | private InputAction_Trigger.Triggered clapDelegate; |
| | 26 | | private InputAction_Trigger.Triggered throwMoneyDelegate; |
| | 27 | | private InputAction_Trigger.Triggered sendKissDelegate; |
| | 28 | |
|
| 0 | 29 | | private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile(); |
| | 30 | |
|
| | 31 | | private void Awake() |
| | 32 | | { |
| 597 | 33 | | waveDelegate = (x) => ExpressionCalled(waveExpression.id); |
| 597 | 34 | | waveExpression.inputAction.OnTriggered += waveDelegate; |
| | 35 | |
|
| 597 | 36 | | robotDelegate = (x) => ExpressionCalled(robotExpression.id); |
| 597 | 37 | | robotExpression.inputAction.OnTriggered += robotDelegate; |
| | 38 | |
|
| 597 | 39 | | fistpumpDelegate = (x) => ExpressionCalled(fistpumpExpression.id); |
| 597 | 40 | | fistpumpExpression.inputAction.OnTriggered += fistpumpDelegate; |
| | 41 | |
|
| 597 | 42 | | raiseHandDelegate = (x) => ExpressionCalled(raiseHandExpression.id); |
| 597 | 43 | | raiseHandExpression.inputAction.OnTriggered += raiseHandDelegate; |
| | 44 | |
|
| 597 | 45 | | clapDelegate = (x) => ExpressionCalled(clapExpression.id); |
| 597 | 46 | | clapExpression.inputAction.OnTriggered += clapDelegate; |
| | 47 | |
|
| 597 | 48 | | throwMoneyDelegate = (x) => ExpressionCalled(throwMoneyExpression.id); |
| 597 | 49 | | throwMoneyExpression.inputAction.OnTriggered += throwMoneyDelegate; |
| | 50 | |
|
| 597 | 51 | | sendKissDelegate = (x) => ExpressionCalled(sendKissExpression.id); |
| 597 | 52 | | sendKissExpression.inputAction.OnTriggered += sendKissDelegate; |
| 597 | 53 | | } |
| | 54 | |
|
| 0 | 55 | | private void ExpressionCalled(string id) { ownUserProfile.SetAvatarExpression(id); } |
| | 56 | | } |