//public GameObject[] buttonRef; //[HideInInspector] //public List<CombinationHandler.Button> Combination = new List<CombinationHandler.Button>(); //public int CombinationSize = 3; //public int Life = 2; //public float Speed = 0.1f; //public bool IsMoving = true; //public int NbrGold = 0; //[HideInInspector] //public Vector3 Position; //public float SpawnCooldown = 1000.0f; //public bool Died = false; //protected GameManager Gm; //protected Dictionary<CombinationHandler.Button, GameObject> ObjectToInstantiate = new Dictionary<CombinationHandler.Button, GameObject>(); //protected BoxCollider boxCollider; //protected List<GameObject> ButtonsEnemy = new List<GameObject>(); //protected GameObject EnemyLifeObj; //protected void Awake() //{ // ObjectToInstantiate[CombinationHandler.Button.BLUE] = Resources.Load<GameObject>("Prefabs/ButtonsEnemy/BlueButton"); // ObjectToInstantiate[CombinationHandler.Button.YELLOW] = Resources.Load<GameObject>("Prefabs/ButtonsEnemy/YellowButton"); // ObjectToInstantiate[CombinationHandler.Button.GREEN] = Resources.Load<GameObject>("Prefabs/ButtonsEnemy/GreenButton"); // ObjectToInstantiate[CombinationHandler.Button.RED] = Resources.Load<GameObject>("Prefabs/ButtonsEnemy/RedButton"); // EnemyLifeObj = Resources.Load<GameObject>("Prefabs/EnemyLife"); // boxCollider = GetComponent<BoxCollider>(); // Position = GetComponent<Transform>().position; //} //public virtual List<CombinationHandler.Button> getCombination() //{ // return Combination; //} //protected void Start() //{ // Gm = GameManager.instance; //} //void Start(List<CombinationHandler.Button> combination, int nbrGold, Vector3 position) //{ // Combination = combination; // NbrGold = nbrGold; // Position = position; // Gm = GameManager.instance; //} //public override void Init(int nLife, int nGold, int nConbinationCount) //{ // this.Life = nLife; // this.NbrGold = nGold; // this.CombinationSize = nConbinationCount; //} protected override void Attack() { foreach (GameObject b in ButtonsEnemy) { b.SetActive(false); } EnemyLifeObj.SetActive(false); IsMoving = false; GetComponent <Animator>().SetTrigger("Attack"); Gm.NotifyDie(gameObject, false); Gm.RemoveLife(1); }
public void MinionDeath(BlackPawnMinon m) { minions.Remove(m); for (int i = 0; i < minions.Count; ++i) { minions[i].addSpeed(0.4f); } if (minions.Count == 0) { Speed = oldSpeed / 10; foreach (GameObject b in ButtonsEnemy) { b.SetActive(true); } EnemyLifeObj.SetActive(true); } }
protected void StartInvisible(int Size, int RLife) { foreach (GameObject b in ButtonsEnemy) { b.SetActive(false); } EnemyLifeObj.SetActive(false); Rend.enabled = false; IsInvisible = true; while (Rockets.Count > 0) { Rockets[0].Explode(); } for (int i = 0; i < 5; ++i) { spawn += 1; Spawn(Size, RLife); } }
protected new void Start() { base.Start(); RectTransform TopPos = GameObject.Find("Canvas/TopBackground").GetComponent <RectTransform>(); RectTransform BottomPos = GameObject.Find("Canvas/ButtonBackground").GetComponent <RectTransform>(); stopPosition = TopPos.position.y + BottomPos.position.y / 2 - boxCollider.size.y * 0.9f; if (Gm.WaveManager.EnemyMax < 5) { Gm.WaveManager.EnemyMax = 5; } foreach (GameObject b in ButtonsEnemy) { b.SetActive(false); } EnemyLifeObj.SetActive(false); Gm.cm.BossMode = true; }
protected IEnumerator Wait() { foreach (GameObject b in ButtonsEnemy) { b.SetActive(false); } EnemyLifeObj.SetActive(false); Rend.enabled = false; float spd = Speed; Speed = 0; yield return(Gm.WaitFor(1.0f)); Speed = spd; foreach (GameObject b in ButtonsEnemy) { b.SetActive(true); } EnemyLifeObj.SetActive(true); Rend.enabled = true; }
protected override void Update() { base.Update(); if (IsInvisible) { if (spawn == 0 && Rockets.Count == 0) { foreach (GameObject b in ButtonsEnemy) { b.SetActive(true); } EnemyLifeObj.SetActive(true); Rend.enabled = true; IsInvisible = false; } } else { if (Rockets.Count + spawn < 2) { StartCoroutine("LaunchAttack", UnityEngine.Random.Range(1, 3)); } } }