First project upload
This commit is contained in:
35
Assets/New Lowpoly Models/Scripts/CharacterRoleSetup.cs
Normal file
35
Assets/New Lowpoly Models/Scripts/CharacterRoleSetup.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class CharacterRoleSetup : MonoBehaviour
|
||||
{
|
||||
public void SetupAsPlayer()
|
||||
{
|
||||
GetComponent<PlayerControllerNewRohan>().enabled = true;
|
||||
GetComponent<PlayerInput>().enabled = true;
|
||||
|
||||
//GetComponent<EnemyAI>().enabled = false;
|
||||
|
||||
var agent = GetComponent<NavMeshAgent>();
|
||||
if (agent != null) agent.enabled = false;
|
||||
|
||||
gameObject.tag = "Player";
|
||||
}
|
||||
|
||||
public void SetupAsEnemy(Transform target)
|
||||
{
|
||||
GetComponent<PlayerControllerNewRohan>().enabled = false;
|
||||
|
||||
//GetComponent<EnemyAI>().enabled = true;
|
||||
//GetComponent<EnemyControllerNew>().target = target;
|
||||
|
||||
var agent = GetComponent<NavMeshAgent>();
|
||||
if (agent != null) agent.enabled = true;
|
||||
|
||||
var input = GetComponent<PlayerInput>();
|
||||
if (input != null) input.enabled = false;
|
||||
|
||||
gameObject.tag = "Enemy";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user