Exemplo n.º 1
0
    public void StartIsle()
    {
        // clear list
        for (int i = 0; i < ListEnemies.Count; i++)
        {
            mr.returnObject(ListEnemies[i].GetComponent <GhostCopy>().ghost.gameObject);
            mr.returnObject(ListEnemies[i]);
        }
        ListEnemies.Clear();

        for (int i = 0; i < EnemyPoints.Count; i++)
        {
            EnemyPoints[i].Initialize();

            if (EnemyPoints[i].CanCreateEnemy == true)
            {
                ExplosionScript expl = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.enemySpawn).GetComponent <ExplosionScript>();
                expl.Initialize(EnemyPoints[i].transform.position);
            }
        }

        enemySpawnRoutine = StartCoroutine(EnemySpawnHandler());

        UI_Canvas ui = mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.UI).GetComponent <UI_Canvas>();

        ui.ShowMessage("Destroy all enemies!");
    }
Exemplo n.º 2
0
    public virtual void die()
    {
        if (currentIsle.ListEnemies.Remove(gameObject) == false)
        {
            print("Komischer Fehler!");  // TODO schauen, ob Fehler noch auftritt
        }

        StopAllCoroutines();

        mr.returnObject(gameObject);

        // destroy ghost
        if (ghostCopy != null)
        {
            mr.returnObject(ghostCopy.ghost.gameObject);
        }

        ExplosionScript expl = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.enemy).GetComponent <ExplosionScript>();

        expl.gameObject.SetActive(true);

        expl.Initialize(transform.position);
    }
Exemplo n.º 3
0
    public void Collect()
    {
        if (Type == ItemType.PortalKey1 || Type == ItemType.PortalKey2 || Type == ItemType.PortalKey3)
        {
            teleport();

            lvlManager.currentIsle.isleObjectType = IsleAbstract.IsleObjectType.normal;
            mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.UI).GetComponent <UI_Canvas>().UpdateMiniMap();
            collected = true;

            PortalIsle portalIsle = lvlManager.bossIsle.IsleObj.GetComponent <PortalIsle>();
            portalIsle.PortalKeys++;

            if (portalIsle.PortalKeys < 3)
            {
                ui.ShowMessage(portalIsle.PortalKeys + " of 3 Portal-Keys collected.");
            }
            else
            {
                ui.ShowMessage("All Portal-Keys collected.\nMain-Portal is open now!");
            }
        }
        else if (Type == ItemType.SmallBox)
        {
            if (opened == true)
            {
                Player player      = mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.player).GetComponent <Player>();
                Stats  playerStats = player.GetComponent <Stats>();

                switch (ContentSmall)
                {
                case ContentTypeSmall.SmallKey: player.NumberSmallKeys++;
                    ui.UpdateKeys(player.NumberSmallKeys);
                    ui.ShowMessage("Small key collected");
                    break;

                case ContentTypeSmall.SpeedUpgrade: playerStats.speed += ContentObj.GetComponent <StatUpgrade>().IncreaseSmallValue;
                    ui.ShowMessage("More Speed!");
                    break;

                case ContentTypeSmall.DamageUpgrade: playerStats.shotStrength += ContentObj.GetComponent <StatUpgrade>().IncreaseSmallValue;
                    ui.ShowMessage("More Damage!");
                    break;

                case ContentTypeSmall.RateUpgrade: playerStats.fireRate *= ContentObj.GetComponent <StatUpgrade>().IncreaseSmallValue;
                    ui.ShowMessage("Fire rate increased!");
                    break;

                case ContentTypeSmall.ShotSpeedUpgrade: playerStats.shotSpeed += ContentObj.GetComponent <StatUpgrade>().IncreaseSmallValue;
                    ui.ShowMessage("Shots are faster!");
                    break;
                }

                ExplosionScript itemEffect = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.itemCollected).GetComponent <ExplosionScript>();
                itemEffect.Initialize(ContentObj.transform.position);

                GameObject heroEffect = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.itemCollectedHero);
                heroEffect.GetComponent <ExplosionScript>().Initialize(player.transform.position);
                heroEffect.GetComponent <Follow>().Initialize(player.gameObject);

                mr.returnObject(ContentObj);
                ContentObj = null;

                collected = true;
            }
        }
        else if (Type == ItemType.BigBox)
        {
            Player player = mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.player).GetComponent <Player>();

            if (player.NumberSmallKeys > 0)
            {
                player.NumberSmallKeys--;
                UI_Canvas ui = mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.UI).GetComponent <UI_Canvas>();
                ui.UpdateKeys(player.NumberSmallKeys);

                OpenBigBox();
            }
        }
    }
Exemplo n.º 4
0
    public IEnumerator checkBigBoxFinishedHandler()
    {
        while (true)
        {
            if (ContentObj.GetComponent <Lerper>().Lerping == false)
            {
                break;
            }
            else
            {
                yield return(new WaitForSeconds(0.3f));
            }
        }

        Player player      = mr.getObject(ObjectPool.categorie.essential, (int)ObjectPool.essential.player).GetComponent <Player>();
        Stats  playerStats = player.GetComponent <Stats>();

        switch (ContentBig)
        {
        case ContentTypeBig.SpeedUpgrade:
            playerStats.speed += ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
            ui.ShowMessage("Much more Speed!");
            break;

        case ContentTypeBig.DamageUpgrade:
            playerStats.shotStrength += ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
            ui.ShowMessage("Much more Damage!");
            break;

        case ContentTypeBig.RateUpgrade:
            playerStats.fireRate *= ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
            ui.ShowMessage("Fire rate extremely increased!");
            break;

        case ContentTypeBig.ShotSpeedUpgrade:
            playerStats.shotSpeed += ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
            ui.ShowMessage("Shots are much faster!");
            break;

        case ContentTypeBig.Splitter:
            if (player.HasSplitter == false)
            {
                player.HasSplitter = true;
                playerStats.possibleShotEffects.Add(new multiplyOnContact());
                ui.ShowMessage("You have Splitter-Shots!");
            }
            else
            {
                playerStats.shotStrength += ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
                ui.ShowMessage("Much more Damage!");
            }
            break;

        case ContentTypeBig.Bluffer:
            if (player.HasBluffer == false)
            {
                player.HasBluffer = true;
                playerStats.possibleShotEffects.Add(new bluff());
                ui.ShowMessage("You have Bluffer-Shots!");
            }
            else
            {
                playerStats.shotStrength += ContentObj.GetComponent <StatUpgrade>().IncreaseBigValue;
                ui.ShowMessage("Much more Damage!");
            }
            break;
        }

        ExplosionScript itemEffect = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.itemCollected).GetComponent <ExplosionScript>();

        itemEffect.Initialize(ContentObj.transform.position);

        GameObject heroEffect = mr.getObject(ObjectPool.categorie.explosion, (int)ObjectPool.explosion.itemCollectedHero);

        heroEffect.GetComponent <ExplosionScript>().Initialize(player.transform.position);
        heroEffect.GetComponent <Follow>().Initialize(player.gameObject);

        mr.returnObject(ContentObj);
        ContentObj = null;

        StopCoroutine(checkBigBoxFinished);

        yield return(null);
    }