Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.0 KiB

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;
}
}