Example #1
0
 void Start()
 {
     agent          = GetComponent <NavMeshAgent>();
     animator       = GetComponent <Animator>();
     interactRange  = agent.stoppingDistance;
     centerPosition = new Vector3(0, 0, 0);
     identity       = GetComponent <PlayerStatsTXT>();
 }
Example #2
0
    public void SpawnWithTxt()
    {
        matchHasStarted = true;

        for (int i = 0; i < stringList.Count; i++)
        {
            float x, y, z;
            x = UnityEngine.Random.Range(-worldSize.x / 2, worldSize.x / 2);
            y = UnityEngine.Random.Range(-worldSize.y / 2, worldSize.y / 2);
            z = UnityEngine.Random.Range(-worldSize.z / 2, worldSize.z / 2);

            Vector3 spawnPosition = new Vector3(x, .5f, z);

            PlayerStatsTXT playerToInstantiate = Instantiate(playerPrefab, spawnPosition, playerPrefab.transform.rotation).GetComponent <PlayerStatsTXT>();
            var            playerMaterial      = playerToInstantiate.GetComponent <MeshRenderer>();
            playerToInstantiate.SetPlayerName(stringList[i]);
            playerMaterial.material.color = colorList[UnityEngine.Random.Range(0, colorList.Count)];
            playersList.Add(playerToInstantiate);
        }
    }
 public void SetPlayerToTarget(PlayerStatsTXT player)
 {
     targetPlayer = player;
 }
Example #4
0
 public void RemovePlayer(PlayerStatsTXT player)
 {
     playersList.Remove(player);
 }