using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Reflection;

public class PlayerSpawnPosition : MonoBehaviour
{
    [Range(0,3)]
    public int PlayerIndex = 0;

    void Awake()
    {
        RegisterLocation();
        // Let the time for the CoinSpawner to be created
        //Invoke("RegisterLocation", 0.2f);
    }

    public void RegisterLocation()
    {
        PlayerManager pspawn = GameObject.FindObjectOfType<PlayerManager>();
        pspawn.RegisterSpawnPoint(this.transform, PlayerIndex);
    }

    void OnDrawGizmos()
    {
        switch(PlayerIndex)
        {
            case 0: Gizmos.color = Color.blue; break;
            case 1: Gizmos.color = Color.red; break;
            case 2: Gizmos.color = Color.green; break;
            case 3: Gizmos.color = Color.yellow; break;
        }

        Gizmos.DrawSphere(transform.position, 0.5f);
    }
}
