Esempio n. 1
0
 private void playerDies(Global.typeOfPlayer player)
 {
     Debug.Log("Executando o OnHealthGoesToZero no LevelManager");
     if (OnRespaw != null)
     {
         foreach (PlayerControl scriptPlayer in listOfPlayers)
         {
             if (scriptPlayer.tipo.Equals(player))
             {
                 if (canRespaw)
                 {
                     OnRespaw(player);
                 }
                 else
                 {
                     InputController.instance.changePlayer(true);
                     OnKillPlayer(player);
                     qtdMortos++;
                     Debug.Log("Jogador Morreu--> " + player.ToString() + " Posicao->" + qtdMortos);
                     if (qtdMortos == listOfPlayers.Count)
                     {
                         Debug.Log("GAME OVER");
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (OnItemActivedByPlayer != null)
     {
         Global.typeOfPlayer player = Global.getTypeOfPlayerByTag(other.tag);
         if (!Global.typeOfPlayer.Player_None.Equals(player) &&
             checkWhoCanIterateWithItem(player))
         {
             if (CanBeDesactived)
             {
                 isItemActive = !isItemActive;
                 animacao.SetBool("ativo", isItemActive);
                 //Trocar esses dois Enum por um bool
                 OnItemActivedByPlayer(isItemActive, Global.getTypeOfPlayerByTag(other.tag), typeOfPlayerCanActived, typeOfInteractiveItem, transform.position);
             }
             else
             {
                 if (isItemActive == false)
                 {
                     isItemActive = true;
                     animacao.SetBool("ativo", true);
                     //Trocar esses dois Enum por um bool
                     OnItemActivedByPlayer(true, Global.getTypeOfPlayerByTag(other.tag), typeOfPlayerCanActived, typeOfInteractiveItem, transform.position);
                 }
             }
         }
     }
 }
Esempio n. 3
0
 private void whoToRespawn(Global.typeOfPlayer player)
 {
     if (tipo.Equals(player))
     {
         Respawn();
     }
 }
Esempio n. 4
0
 private void whoToKill(Global.typeOfPlayer player)
 {
     if (tipo.Equals(player))
     {
         killPlayer();
     }
 }
Esempio n. 5
0
    private void soundPlayerHurt(int damage, Global.typeOfPlayer player)
    {
        Debug.Log("Executando o OnHurt no SoundController");
        switch (player)
        {
        case Global.typeOfPlayer.Player_Bege:
            hurtBege.Play();
            break;

        case Global.typeOfPlayer.Player_Blue:
            hurtBlue.Play();
            break;

        case Global.typeOfPlayer.Player_Green:
            hurtGreen.Play();
            break;

        case Global.typeOfPlayer.Player_Pink:
            hurtPink.Play();
            break;

        case Global.typeOfPlayer.Player_Yellow:
            hurtYellow.Play();
            break;

        default:
            break;
        }
    }
Esempio n. 6
0
    private void soundItemCatch(int valueOfItem,
                                Global.typeOfPlayer player,
                                CollectiablesController item)
    {
        switch (item.typeOfItem)
        {
        case Global.typeOfItem.Gem_Blue:
        case Global.typeOfItem.Gem_Green:
        case Global.typeOfItem.Gem_Red:
        case Global.typeOfItem.Gem_Yellow:
            catchGem.Play();
            break;

        case Global.typeOfItem.Key_Blue:
        case Global.typeOfItem.Key_Green:
        case Global.typeOfItem.Key_Red:
        case Global.typeOfItem.Key_Yellow:
            catchKey.Play();
            break;

        case Global.typeOfItem.Gold_Coin:
            catchGoldCoin.Play();
            break;

        default:
            break;
        }
    }
Esempio n. 7
0
 private void respawPlayer(Global.typeOfPlayer type)
 {
     hearths       = ScoreController.instance.getCurrentHealthFromPlayer(type);
     currentHealth = ScoreController.instance.getHearthsFromPlayer(type);
     setQuantidadeCoracao(hearths);
     updateHealthShow();
 }
Esempio n. 8
0
 void OnTriggerExit2D(Collider2D outro)
 {
     Global.typeOfPlayer tipo = Global.getTypeOfPlayerByTag(outro.tag);
     if (!tipo.Equals(Global.typeOfPlayer.Player_None))
     {
         StartCoroutine("PararEm2Segudos");
     }
 }
Esempio n. 9
0
 void OnTriggerStay2D(Collider2D outro)
 {
     Global.typeOfPlayer tipo = Global.getTypeOfPlayerByTag(outro.tag);
     if (!tipo.Equals(Global.typeOfPlayer.Player_None))
     {
         startMovimento();
     }
 }
Esempio n. 10
0
    private void changedPlayer(IPlayerAction action, Global.typeOfPlayer type)
    {
        action.changedPlayer(LevelManager.instance.listOfPlayers, botaoMudarJogador, playerAtivo);

        hearths       = ScoreController.instance.getHearthsFromPlayer(type);
        currentHealth = ScoreController.instance.getCurrentHealthFromPlayer(type);
        setQuantidadeCoracao(hearths);
        //updateHealthShow();
    }
Esempio n. 11
0
 private void respawCollectibles(Global.typeOfPlayer player)
 {
     if (!this.gameObject.activeSelf && canRespaw &&
         typeOfPlayerThatCanCatchItem.Equals(player))
     {
         this.gameObject.SetActive(true);
         this.ResetObject();
     }
 }
Esempio n. 12
0
 private void itemActived(bool actived, Global.typeOfPlayer player,
                          Global.typeOfPlayer playerThatCanActived,
                          Global.InteractiveItem item, Vector3 positionOfItem)
 {
     if (tipo.Equals(playerThatCanActived) && actived && Global.InteractiveItem.CheckPoint.Equals(item))
     {
         respawnPosition = positionOfItem;
     }
 }
Esempio n. 13
0
 private bool checkWhoCanIterateWithItem(Global.typeOfPlayer player)
 {
     if (allPlayersCanCatch)
     {
         return(true);
     }
     else
     {
         return(typeOfPlayerCanActived.Equals(player));
     }
 }
Esempio n. 14
0
 private bool checkWhoCanCatchItem(Global.typeOfPlayer player)
 {
     if (allPlayersCanCatch)
     {
         return(true);
     }
     else
     {
         return(typeOfPlayerThatCanCatchItem.Equals(player));
     }
 }
Esempio n. 15
0
    private void itemCatch(int valueOfItem, Global.typeOfPlayer player, CollectiablesController item)
    {
        if (Global.typeOfItem.Star.Equals(item.typeOfItem) && tipo.Equals(player))
        {
            Debug.Log("Pegou Estrela-->" + valueOfItem);
            contadorInvencibilidade = valueOfItem;
            Invoke("ContadorInvencibilidade", valueOfItem);
            invencivel = true;

            StartCoroutine(flashSprites(sprites, valueOfItem));
        }
    }
Esempio n. 16
0
    public void carregarValoresInicias(Global.typeOfPlayer tipo)
    {
        setQuantidadeChaves(quantidadeChaves);

        setQuantidadeInicialMoedas(quantidadeMoeda);

        if (!Global.typeOfPlayer.Player_None.Equals(tipo))
        {
            currentHealth = ScoreController.instance.getCurrentHealthFromPlayer(tipo);
            setQuantidadeCoracao(ScoreController.instance.getHearthsFromPlayer(tipo));
        }
    }
Esempio n. 17
0
 private void soundItemActived(bool actived, Global.typeOfPlayer player, Global.typeOfPlayer playerThatCanActived, Global.InteractiveItem item, Vector3 position)
 {
     if (player.Equals(playerThatCanActived))
     {
         if (actived)
         {
             interactiveItemOn.Play();
         }
         else
         {
             interactiveItemOff.Play();
         }
     }
 }
Esempio n. 18
0
    private void respawPlayer(Global.typeOfPlayer player)
    {
        //TODO arrumar isso aqui, nao pode ter inicializacao de tudo qdo der respaw
        //initializeHealthCoins();
        totalCurrentCoins           -= currentCoinsByPlayer[player];
        currentCoinsByPlayer[player] = 0;

        foreach (CollectiablesController collectiable in listItensCatch)
        {
            if (collectiable.canRespaw)
            {
                collectiable.ResetObject();
            }
        }
    }
Esempio n. 19
0
    private void upadateItemCatch(int valueOfItem,
                                  Global.typeOfPlayer player,
                                  CollectiablesController item)
    {
        if (!Global.typeOfItem.Item_None.Equals(item))
        {
            if (item.canRespaw)
            {
                listItensCatch.Add(item);
            }
        }

        switch (item.typeOfItem)
        {
        case Global.typeOfItem.Gem_Blue:
        case Global.typeOfItem.Gem_Green:
        case Global.typeOfItem.Gem_Red:
        case Global.typeOfItem.Gem_Yellow:
        case Global.typeOfItem.Key_Blue:
        case Global.typeOfItem.Key_Green:
        case Global.typeOfItem.Key_Red:
        case Global.typeOfItem.Key_Yellow:
            itens[item.typeOfItem] = true;
            break;

        case Global.typeOfItem.Health_empty:
            maxHealth[player] += valueOfItem;
            break;

        case Global.typeOfItem.Health_full:
            currentHealth[player] = maxHealth[player];
            break;

        case Global.typeOfItem.Health_half:
            currentHealth[player] += valueOfItem;
            break;

        case Global.typeOfItem.Gold_Coin:
            currentCoinsByPlayer[player] += valueOfItem;
            totalCurrentCoins            += valueOfItem;
            return;

        default:
            return;
        }
    }
Esempio n. 20
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (OnItemCollect != null)
     {
         Global.typeOfPlayer player = Global.getTypeOfPlayerByTag(other.tag);
         //Qualquer tag nao encontrada sera definida como Player_None
         //Tem q ser um Player e tem que estar apto a pegar o item
         if (!Global.typeOfPlayer.Player_None.Equals(player) &&
             checkWhoCanCatchItem(player))
         {
             typeOfPlayerThatCanCatchItem = player;
             OnItemCollect(valueOfItem, player, this);
             //TODO verificar se como fica o delagate das classes pressas a ele
             //Destroy (gameObject);
             gameObject.SetActive(false);
         }
     }
 }
Esempio n. 21
0
    private void actionController(IPlayerAction action)
    {
        if (action.changePlayer(listOfPlayers))
        {
            Global.typeOfPlayer type = Global.typeOfPlayer.Player_None;

            foreach (PlayerControl player in listOfPlayers)
            {
                if (player.isAtivo)
                {
                    type = player.tipo;
                    break;
                }
            }

            if (OnLevelAction != null)
            {
                OnLevelAction(action, type);
            }
        }
    }
Esempio n. 22
0
    private void actionController(IPlayerAction action)
    {
        if (action.GetType() == typeof(ActionJump))
        {
            PlayerControl       player     = LevelManager.instance.getActivePlayer();
            Global.typeOfPlayer tipoPlayer = Global.typeOfPlayer.Player_None;

            if (player != null)
            {
                tipoPlayer = player.tipo;
            }

            switch (tipoPlayer)
            {
            case Global.typeOfPlayer.Player_Bege:
                action.playSound(playerJumpBege, player.isGrounded && player.isAtivo);
                break;

            case Global.typeOfPlayer.Player_Blue:
                action.playSound(playerJumpBlue, player.isGrounded && player.isAtivo);
                break;

            case Global.typeOfPlayer.Player_Green:
                action.playSound(playerJumpGreen, player.isGrounded && player.isAtivo);
                break;

            case Global.typeOfPlayer.Player_Pink:
                action.playSound(playerJumpPink, player.isGrounded && player.isAtivo);
                break;

            case Global.typeOfPlayer.Player_Yellow:
                action.playSound(playerJumpYellow, player.isGrounded && player.isAtivo);
                break;

            default:
                break;
            }
        }
    }
Esempio n. 23
0
    private void updateHealth(int damage, Global.typeOfPlayer player)
    {
        Debug.Log("Executando o OnHurt no ScoreController");
        switch (player)
        {
        case Global.typeOfPlayer.Player_None:
            return;

        default:
            currentHealth[player] -= damage;
            Debug.Log("Life " + player.ToString() + " ->" + currentHealth[player]);
            if (currentHealth[player] <= 0)
            {
                if (OnHealthGoesToZero != null)
                {
                    Debug.Log("Player->" + player.ToString() + " morreu executando OnHealthGoesToZero");
                    OnHealthGoesToZero(player);
                }
            }
            return;
        }
    }
Esempio n. 24
0
    private void executarFerimento(Collider2D outro)
    {
        Global.typeOfPlayer tipo = Global.getTypeOfPlayerByTag(outro.tag);

        if (OnHurtPlayer != null)
        {
            //Qualquer tag nao encontrada sera definida como Player_None
            //Assim qualquer outro tipo de jogador ira sofre dano
            switch (tipo)
            {
            case Global.typeOfPlayer.Player_None:
                break;

            default:
                //Será que isso eh perfomatico?
                if (canHurt(outro.GetComponent <PlayerControl>()))
                {
                    Debug.Log("Executando Dano, Chamando todos os Eventos");
                    OnHurtPlayer(damage, tipo);
                }
                break;
            }
        }
    }
Esempio n. 25
0
 public int getCurrentHealthFromPlayer(Global.typeOfPlayer typeOfPlayer)
 {
     return(currentHealth[typeOfPlayer]);
 }
Esempio n. 26
0
 private void updateHearthDamage(int dano, Global.typeOfPlayer type)
 {
     Debug.Log("Executando o OnHurt no UIControl");
     currentHealth -= dano;
     updateHealthShow();
 }
Esempio n. 27
0
    //Metodos Privados
    private void catchItem(int add, Global.typeOfPlayer player, CollectiablesController item)
    {
        switch (item.typeOfItem)
        {
        case Global.typeOfItem.Gem_Blue:
            gema_azul.gameObject.SetActive(true);
            gema_azul.sprite = s_gema_azul;
            break;

        case Global.typeOfItem.Gem_Green:
            gema_verde.gameObject.SetActive(true);
            gema_verde.sprite = s_gema_verde;
            break;

        case Global.typeOfItem.Gem_Red:
            gema_vermelho.gameObject.SetActive(true);
            gema_vermelho.sprite = s_gema_laranja;
            break;

        case Global.typeOfItem.Gem_Yellow:
            gema_amarelo.gameObject.SetActive(true);
            gema_amarelo.sprite = s_gema_amarela;
            break;

        case Global.typeOfItem.Key_Blue:
            chave_azul.sprite = s_key_azul_enable;
            break;

        case Global.typeOfItem.Key_Green:
            chave_verde.sprite = s_key_verde_enable;
            break;

        case Global.typeOfItem.Key_Red:
            chave_vermelho.sprite = s_key_vermelho_enable;
            break;

        case Global.typeOfItem.Key_Yellow:
            chave_amarelo.sprite = s_key_amarelo_enable;
            break;

        case Global.typeOfItem.Health_empty:
            setQuantidadeCoracao(hearths + add);
            break;

        case Global.typeOfItem.Health_half:
            currentHealth += add;
            updateHealthShow();
            break;

        case Global.typeOfItem.Health_full:
            currentHealth = hearths * 2;
            updateHealthShow();
            break;

        case Global.typeOfItem.Gold_Coin:
            currentCoin += add;
            updateCurrentCoins();
            break;

        default:
            break;
        }
    }
Esempio n. 28
0
 public int getHearthsFromPlayer(Global.typeOfPlayer typeOfPlayer)
 {
     return(maxHealth[typeOfPlayer] / 2);
 }
Esempio n. 29
0
 public void machucarJogador(int dano, Global.typeOfPlayer type)
 {
     Debug.Log("Executando o OnHurt no PlayerControl");
     // startKnockbackAction();
 }