Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        paused       = true;
        pauseMenu    = pauseCanvas.GetComponent <CanvasGroup>();
        sacrifceMenu = sacrificeCanvas.GetComponent <CanvasGroup>();
        buffMenu     = buffCanvas.GetComponent <CanvasGroup>();
        IntroMenu    = IntroCanvas.GetComponent <CanvasGroup>();

        hudGroup = HUDCanvas.GetComponent <CanvasGroup>();
        for (int i = 0; i < weapons.Length; i++)
        {
            weapons[i] = GameObject.Instantiate(weapons[i]);
        }

        mainChar playerS = player.GetComponent <mainChar>();

        playerS.updateWeapon(0, weapons[0]);
        playerS.updateWeapon(1, weapons[1]);
        playerS.updateWeapon(2, weapons[2]);


        pickedSacrifices    = new int[4];
        pickedSacrifices[0] = 0;
        pickedSacrifices[1] = 0;
        pickedSacrifices[2] = 0;
        pickedSacrifices[3] = 0;
    }
Ejemplo n.º 2
0
    void waveOver()
    {
        gameState = 2;
        mainChar p = player.GetComponent <mainChar>();

        waitingForWave = true;
        if (p.hpRegen)
        {
            wasHealding = true;
            p.hpRegen   = false;
        }
        ShowUI(pauseMenu);
        //Reset HP of Char

        //Show pop up for sacrifice options
    }
Ejemplo n.º 3
0
    void runGame()
    {
        StopCoroutine(coroutine);
        hideShowInput(false);
        mainCharObject.SetActive(true);
        enemyCharObject.SetActive(true);
        mainCharProp  = new mainChar();
        enemyCharProp = new enemyChar();
        mainCharProp  = mainCharObject.GetComponent <mainChar> ();
        mainCharProp.setChar(this.name, 50, 50, 10, 10, 10, 1);
        enemyCharProp = enemyCharObject.GetComponent <enemyChar> ();
        enemyCharProp.randChar(1);

        /*
         * while (!leaveGame) {
         *      leaveGame = true;
         * }
         */
    }
Ejemplo n.º 4
0
    void nextWave()
    {
        Debug.Log("Next Wave Called");
        mainChar p = player.GetComponent <mainChar>();

        if (wasHealding)
        {
            p.hpRegen = true;
        }

        wave++;
        waveText.text = "Wave : " + wave;
        //Spawn All the new Baddies

        //Pop Up Menu to sacrifce stuff
        for (int i = 0; i < wave * 5 + 10; i++)
        {
            SpawnBaddie();
        }
        //Start next wave
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        Collider2D[] firsHit = new Collider2D[1];

        col.OverlapCollider(new ContactFilter2D(), firsHit);

        if (firsHit[0] != null)
        {
            if (baddieProjectile)
            {
                if (firsHit[0].gameObject.tag.Equals("Player"))
                {
                    // Object.Destroy(firsHit[0].gameObject);
                    mainChar b = firsHit[0].GetComponent <mainChar>();

                    b.takeDamage(damage);
                    Object.Destroy(gameObject);
                }


                if (!firsHit[0].gameObject.tag.Equals("Baddie"))
                {
                    Object.Destroy(gameObject);
                }
            }
            else
            {
                if (firsHit[0].gameObject.tag.Equals("Baddie"))
                {
                    // Object.Destroy(firsHit[0].gameObject);
                    Baddie b = firsHit[0].GetComponent <Baddie>();


                    if (b.hp - damage < 0)
                    {
                        int newdamage = damage - b.hp;

                        b.takeDamg(damage);
                        damage = newdamage;
                    }
                    else
                    {
                        b.takeDamg(damage);
                        hits = peirce;
                    }
                    hits++;
                }


                if (!firsHit[0].gameObject.tag.Equals("Player") && hits > peirce || firsHit[0].gameObject.tag.Equals("Wall"))
                {
                    Object.Destroy(gameObject);
                }
            }
        }

        transform.Translate(new Vector3(Time.deltaTime * speed * 50, 0, 0));

        if (!render.isVisible)
        {
            Object.Destroy(gameObject);
        }
    }
Ejemplo n.º 6
0
    public void aquireBuff()
    {
        mainChar p = player.GetComponent <mainChar>();

        //Apply selected buff
        switch (selectedBuffPicked)
        {
        case 1:     //Attack speed
            btns[1].interactable = false;
            icons[7].alpha       = 1.0f;

            //Reduce attack speed my 1/2
            for (int i = 0; i < weapons.Length; i++)
            {
                if (weapons[i].tag.Equals("Melee"))
                {
                    MeleeAttack mA = weapons[i].GetComponent <MeleeAttack>();

                    mA.attackSpeedMod = 0.5f;
                }
                else
                {
                    RangedAttack mA = weapons[i].GetComponent <RangedAttack>();

                    mA.attackSpeed = 0.5f;
                }
            }

            break;

        case 2:     //Healing
            btns[2].interactable = false;
            icons[9].alpha       = 1.0f;
            p.hpRegen            = true;
            break;

        case 3:     ///Power Strike
            btns[3].interactable = false;
            icons[12].alpha      = 1.0f;

            //Reduce attack speed my 1/2
            for (int i = 0; i < weapons.Length; i++)
            {
                if (weapons[i].tag.Equals("Melee"))
                {
                    MeleeAttack mA = weapons[i].GetComponent <MeleeAttack>();

                    mA.cleaveNumber *= 2;
                    mA.attackDamage *= 2;
                }
                else
                {
                    RangedAttack mA = weapons[i].GetComponent <RangedAttack>();

                    mA.peirceMod = 2;
                }
            }



            break;

        case 4:     //Teleportation
            btns[4].interactable = false;
            icons[10].alpha      = 1.0f;
            p.activeSpells[0]    = 1;

            break;

        case 5:     //More HP
            btns[5].interactable = false;
            icons[13].alpha      = 1.0f;
            p.hp        = 200;
            p.currentHp = 200;
            p.updateHP();
            break;

        case 6:     //FireBall
            btns[6].interactable = false;
            icons[11].alpha      = 1.0f;
            p.activeSpells[1]    = 1;

            break;

        case 7:     //Enemy Slow
            btns[7].interactable = false;
            enemyMoveSpeedMod    = 0.5f;
            icons[8].alpha       = 1.0f;
            break;
        }

        hideUI(buffMenu);
        readyForNextWave();
    }
Ejemplo n.º 7
0
    public void activateSacrifice()
    {
        hideUI(sacrifceMenu);
        ShowUI(buffMenu);


        mainChar p = player.GetComponent <mainChar>();

        switch (selectedSacrificePicked)
        {
        case 1:

            //Reduce attack speed my 1/2
            for (int i = 0; i < weapons.Length; i++)
            {
                if (weapons[i].tag.Equals("Melee"))
                {
                    MeleeAttack mA = weapons[i].GetComponent <MeleeAttack>();
                    if (pickedSacrifices[0] == 0)
                    {
                        mA.attackSpeedMod = 2.0f;
                    }
                    else
                    {
                        mA.attackSpeedMod = 200.0f;
                    }
                }
                else
                {
                    RangedAttack mA = weapons[i].GetComponent <RangedAttack>();


                    if (pickedSacrifices[0] == 0)
                    {
                        mA.attackSpeedMod = 2.0f;
                    }
                    else
                    {
                        mA.attackSpeed = 200.0f;
                    }
                }
            }

            pickedSacrifices[0]++;

            if (pickedSacrifices[0] == 1)
            {
                icons[1].alpha = 1.0f;
            }
            else
            {
                btns[10].interactable = false;
                icons[5].alpha        = 1.0f;
            }

            break;

        case 2:
            //Reduce Vision by half

            if (pickedSacrifices[1] == 0)
            {
                pickedSacrifices[1]++;
                icons[0].alpha = 1.0f;
                partBlind.show();
            }
            else
            {
                icons[4].alpha = 1.0f;
                fullBlind.show();
                partBlind.hide();
                btns[9].interactable = false;
            }

            break;

        case 3:
            //Reduce Movement Speed by half

            if (pickedSacrifices[2] == 0)
            {
                p.speedMod *= 0.5f;
                pickedSacrifices[2]++;
                icons[2].alpha = 1.0f;
            }
            else
            {
                p.speedMod            = 0.0f;
                icons[6].alpha        = 1.0f;
                btns[11].interactable = false;
            }

            break;

        case 4:
            //Remove hp gain from drops
            icons[3].alpha       = 1.0f;
            p.canEat             = false;
            btns[8].interactable = false;
            break;
        }

        selectedSacrificePicked = -1;
    }
Ejemplo n.º 8
0
    void resetGame()
    {
        ShowUI(IntroMenu);

        foreach (Button btn in btns)
        {
            if (btn != null)
            {
                btn.interactable = true;
            }
        }

        foreach (GameObject bad in baddiesList)
        {
            Destroy(bad);
        }

        baddiesList.Clear();
        waveOver();
        wave          = 0;
        waveText.text = "Wave : " + wave;
        mainChar playerS = player.GetComponent <mainChar>();

        playerS.currentHp = playerS.hp;
        playerS.dead      = false;

        foreach (CanvasGroup C in icons)
        {
            C.alpha = 0;
        }

        for (int i = 0; i < pickedSacrifices.Length; i++)
        {
            pickedSacrifices[i] = 0;
        }

        fullBlind.hide();
        partBlind.hide();

        //Reduce attack speed my 1/2
        for (int i = 0; i < weapons.Length; i++)
        {
            if (weapons[i].tag.Equals("Melee"))
            {
                MeleeAttack mA = weapons[i].GetComponent <MeleeAttack>();

                mA.attackSpeedMod = 1.0f;
            }
            else
            {
                RangedAttack mA = weapons[i].GetComponent <RangedAttack>();


                mA.attackSpeed = 1.0f;
            }
        }


        mainChar p = player.GetComponent <mainChar>();

        p.slowDown  = 1.0f;
        p.speedMod  = 1.0f;
        p.hpRegen   = false;
        wasHealding = false;
        p.canEat    = true;
    }