Exemplo n.º 1
0
    //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);
    }