Exemple #1
0
    public virtual void FsmInit()
    {
        fsmManager = new FsmManager((int)PlayerAnimationEnum.Max);

        PlayerIdle playerIdle = new PlayerIdle(anim, this);

        PlayerRun playerRun = new PlayerRun(anim, this);

        PlayerAttack1 playerAttack1 = new PlayerAttack1(anim, this);

        PlayerAttack2 playerAttack2 = new PlayerAttack2(anim, this);

        PlayerAttack3 playerAttack3 = new PlayerAttack3(anim, this);


        fsmManager.AddState(playerIdle);

        fsmManager.AddState(playerRun);

        fsmManager.AddState(playerAttack1);

        fsmManager.AddState(playerAttack2);

        fsmManager.AddState(playerAttack3);

        fsmManager.ChangeState((int)PlayerAnimationEnum.Idle);
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     ammo            = 10;
     direction       = 4;
     ammoNumber.text = ammo.ToString();
     rb2d            = GetComponent <Rigidbody2D>();
     anim            = GetComponent <Animator>();
     playerHealth    = GetComponent <PlayerHealth>();
     playerAttack0   = GetComponentInChildren <PlayerAttack0>();
     playerAttack1   = GetComponentInChildren <PlayerAttack1>();
     playerAttack2   = GetComponentInChildren <PlayerAttack2>();
     playerAttack3   = GetComponentInChildren <PlayerAttack3>();
 }
Exemple #3
0
 // Use this for initialization
 void Start()
 {
     audioSource    = GetComponent <AudioSource>();
     thePlayer      = GameObject.FindGameObjectWithTag("Player");
     playerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>();
     enemyMovement  = GetComponent <EnemyMovement>();
     playerAttack0  = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <PlayerAttack0>();
     playerAttack1  = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <PlayerAttack1>();
     playerAttack2  = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <PlayerAttack2>();
     playerAttack3  = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <PlayerAttack3>();
     scoreManager   = GameObject.FindGameObjectWithTag("Score").GetComponent <ScoreManager>();
     rb2d           = GetComponent <Rigidbody2D>();
     collide        = GetComponent <CapsuleCollider2D>();
     trigger        = GetComponentInChildren <CircleCollider2D>();
     rend           = GetComponent <Renderer>();
     anim           = GetComponent <Animator>();
     currentHealth  = health;
 }
    // Start is called before the first frame update
    void Start()
    {
        playerInv = new Dictionary <string, bool>();
        playerInv.Add("Skill1V1", false);
        playerInv.Add("Skill1V2", false);
        playerInv.Add("Skill1V3", false);
        playerInv.Add("Skill2V1", false);
        playerInv.Add("Skill2V2", false);
        playerInv.Add("Skill2V3", false);
        playerInv.Add("Skill3V1", false);
        playerInv.Add("Skill3V2", false);
        playerInv.Add("Skill3V3", false);

        playerH = GetComponent <PlayerHealth>();
        playerA = GetComponent <PlayerAttack1>();

        isLifeSteal = false;
    }
    public void onClickSkill3()
    {
        //IR BUSCAR O ARRAY LIST PP DE PODERES
        //VERIFICAR QUAL A VERSAO DA SKILL 1, E ALTERAR A IMAGEM
        //APLICAR A FUNÇÃO COM A RESPETIVA % DA VERSAO EM QUE ESTEJA
        //PP.addHealth(x);

        if (PhotonNetwork.LocalPlayer == PhotonNetwork.MasterClient)
        {
            PlayerAttack1 playerA = GameObject.FindGameObjectWithTag("Player2").GetComponent <PlayerAttack1>();
            PlayerHealth  playerH = GameObject.FindGameObjectWithTag("Player2").GetComponent <PlayerHealth>();
            int           lifeTaken;
            if (PP.playerInv["Skill3V1"] == true)
            {
                lifeTaken = 100;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
            else if (PP.playerInv["Skill3V2"] == true)
            {
                lifeTaken = 150;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
            else if (PP.playerInv["Skill3V3"] == true)
            {
                lifeTaken = 180;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
        }
        else
        {
            PlayerAttack1 playerA = GameObject.FindGameObjectWithTag("Player1").GetComponent <PlayerAttack1>();
            PlayerHealth  playerH = GameObject.FindGameObjectWithTag("Player1").GetComponent <PlayerHealth>();;
            int           lifeTaken;
            if (PP.playerInv["Skill3V1"] == true)
            {
                lifeTaken = 100;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
            else if (PP.playerInv["Skill3V2"] == true)
            {
                lifeTaken = 150;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
            else if (PP.playerInv["Skill3V3"] == true)
            {
                lifeTaken = 180;
                playerA.skillTrois();
                playerH.TakeDamageSkill3(lifeTaken);
            }
        }

        if (PP.playerInv["Skill3V1"] || PP.playerInv["Skill3V2"] || PP.playerInv["Skill3V3"])
        {
            sfxAudio.skill3Sound();
            animation.SetTrigger("Ulti");
            isCooldownSkill3 = true;
            textCooldownSkill3.gameObject.SetActive(true);
            cooldownTimerSkill3    = cooldownTimeSkill3;
            skill3Btn.interactable = false;
        }
    }