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 EnemyManager : MonoBehaviour
- {
- [HideInInspector]public EnemyHealth EHealth;
- public GameObject EnemyTank;
- public Transform[] EnemySpawn;
- [HideInInspector] public GameObject Instance;
- public Color EnemyColor;
- private EnemyMovement EMove;
- private EnemyAttack EAttack;
- public void ESetup ()
- {
- EMove = Instance.GetComponent<EnemyMovement> ();
- EAttack = Instance.GetComponent<EnemyAttack> ();
- MeshRenderer[] ERender = Instance.GetComponentsInChildren<MeshRenderer> ();
- for (int i = 0; i < ERender.Length; i++)
- {
- ERender [i].material.color = EnemyColor;
- }
- }
- public void DisableEControl ()
- {
- EMove.enabled = false;
- EAttack.enabled = false;
- }
- public void EnableEControl ()
- {
- EMove.enabled = true;
- EAttack.enabled = true;
- }
- public void ESpawn ()
- {
- int randomSpawn = Random.Range (0, EnemySpawn.Length);
- Instantiate (EnemyTank, EnemySpawn[randomSpawn].position, EnemySpawn[randomSpawn].rotation);
- }
- }
- }
Add Comment
Please, Sign In to add comment