init
This commit is contained in:
commit
e0a842f222
796 changed files with 361371 additions and 0 deletions
91
Assets/Scripts/Player/PlayerManager.cs
Normal file
91
Assets/Scripts/Player/PlayerManager.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
public class PlayerManager : MonoBehaviour{
|
||||
|
||||
//public CinemachineVirtualCamera followCamera;
|
||||
|
||||
public ParticleSystem impactParticles;
|
||||
|
||||
PlayerMovement currentPlayer;
|
||||
|
||||
[Space]
|
||||
[SerializeField] PlayerMovement player1;
|
||||
[SerializeField] PlayerMovement player2;
|
||||
|
||||
public PlayerMovement Player1
|
||||
{
|
||||
get
|
||||
{
|
||||
return player1;
|
||||
}
|
||||
}
|
||||
public PlayerMovement Player2
|
||||
{
|
||||
get
|
||||
{
|
||||
return player2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Space]
|
||||
[SerializeField, Range(0f, 1f)] float defaultTime = 1f;
|
||||
[SerializeField, Range(0f, 1f)] float slowTime = .1f;
|
||||
|
||||
[HideInInspector] public PlayerMovement playerMoving;
|
||||
|
||||
// Start is called before the first frame update
|
||||
public void Init(){
|
||||
currentPlayer = player1;
|
||||
|
||||
//followCamera.Follow = player1.transform;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
|
||||
}
|
||||
|
||||
private void ActivityHandle()
|
||||
{
|
||||
//if (Input.GetKeyDown(KeyCode.Space))
|
||||
//{
|
||||
// if (currentPlayer == player1)
|
||||
// {
|
||||
// //followCamera.Follow = player2.transform;
|
||||
// currentPlayer.active = false;
|
||||
// currentPlayer = player2;
|
||||
// currentPlayer.active = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //followCamera.Follow = player1.transform;
|
||||
// currentPlayer.active = false;
|
||||
// currentPlayer = player1;
|
||||
// currentPlayer.active = true;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
public void Move(PlayerMovement player){
|
||||
Time.timeScale = defaultTime;
|
||||
playerMoving = player;
|
||||
}
|
||||
|
||||
public void Stop(){
|
||||
Time.timeScale = slowTime;
|
||||
playerMoving = null;
|
||||
}
|
||||
|
||||
public GameObject getClosestPlayer(Vector3 position)
|
||||
{
|
||||
if (Vector3.Magnitude(position - player1.transform.position) < Vector3.Magnitude(position - player2.transform.position))
|
||||
return player1.gameObject;
|
||||
|
||||
return player2.gameObject;
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue