|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.InputSystem;
-
- public class PlayerJoinIcon : MonoBehaviour
- {
-
- private PlayerData m_data;
- private Vector3 m_startingScale;
-
-
- private void OnEnable()
- {
- m_startingScale = transform.localScale;
- Debug.Log("New player awake");
- if (m_data != null)
- {
- m_data.Input.currentActionMap.FindAction("Ping").started += OnPlayerPing;
- m_data.Input.currentActionMap.FindAction("Ping").canceled += OnPlayerPing;
- }
-
-
- }
-
- public void Initialise(PlayerData data)
- {
- Debug.Log("Initialised new Player");
- m_data = data;
- }
-
- public void OnPlayerPing(InputAction.CallbackContext args)
- {
- Debug.Log($"Ping: {args.phase}");
- if (args.phase == InputActionPhase.Started)
- transform.localScale = m_startingScale * 1.1f;
- else if (args.phase == InputActionPhase.Canceled)
- transform.localScale = m_startingScale;
- }
-
-
- }
|