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

public class DiscoBombController : MonoBehaviour
{
    public RuntimeAnimatorController[] Player2Anims;
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("Player 1 Count: " + PlayerPrefs.GetFloat("Player1Count"));
        Debug.Log("Player 2 Count: " + PlayerPrefs.GetFloat("Player2Count"));

        if (other.gameObject.tag == "Player1")
        {
            other.gameObject.tag = "Player2";
            other.gameObject.GetComponent<NeutralRandomMove>().enabled = false;
            other.gameObject.GetComponent<Player1Controller>().enabled = false;
            other.gameObject.GetComponent<Player2Controller>().enabled = true;
            other.gameObject.GetComponent<SpriteRenderer>().color = Color.white;
            other.gameObject.GetComponent<Animator>().runtimeAnimatorController = Player2Anims[UnityEngine.Random.Range(0,5)];
            other.gameObject.GetComponent<Rigidbody>().AddForce((other.transform.position - transform.position) * (UnityEngine.Random.Range(20, 25) * 100));

        }
    }
}
