Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- using PlayerInfo;
- using EnemyInfo;
- namespace Management
- {
- public class PlayerManager : MonoBehaviour
- {
- [HideInInspector]public PlayerHealth PHealth;
- public GameObject PlayerTank;
- public Transform[] PlayerSpawn;
- [HideInInspector] public GameObject Instance;
- public Color PlayerColor;
- private PlayerMovement PMove;
- private PlayerAttack PAttack;
- public void PSetup ()
- {
- PMove = Instance.GetComponent<PlayerMovement> ();
- PAttack = Instance.GetComponent<PlayerAttack> ();
- MeshRenderer[] PRender = Instance.GetComponentsInChildren<MeshRenderer> ();
- for (int i = 0; i < PRender.Length; i++)
- {
- PRender [i].material.color = PlayerColor;
- }
- }
- public void DisablePControl ()
- {
- PMove.enabled = false;
- PAttack.enabled = false;
- }
- public void EnablePControl ()
- {
- PMove.enabled = true;
- PAttack.enabled = true;
- }
- public void PSpawn ()
- {
- int randomSpawn = Random.Range (0, PlayerSpawn.Length);
- Instantiate (PlayerTank, PlayerSpawn[randomSpawn].position, PlayerSpawn[randomSpawn].rotation);
- }
- }
- }
Add Comment
Please, Sign In to add comment