Esempio n. 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (Aturdido == false)
        {
            if (collision.gameObject.tag == "Proyectil")
            {
                //  rb.AddRelativeForce(transform.forward * (fuerza / Time.deltaTime));
                AudioSource.PlayClipAtPoint(Golpe, transform.position, 3f);
                sr.color = Color.red;
                vida--;
                rb.AddRelativeForce(collision.gameObject.transform.up, ForceMode2D.Impulse);
                golpeado = true;
            }

            if (collision.gameObject.tag == "Player")
            {
                Destroy(this.gameObject, 0);
                GameObject aux = Instantiate(explosionMuerte, transform.position, transform.rotation);
                AudioSource.PlayClipAtPoint(Explosion, transform.position, 3f);
                StatsPlayer statsP = player.GetComponent <StatsPlayer>();
                statsP.restarVida();
            }
        }
        else
        {
            if (collision.gameObject.tag == "Proyectil")
            {
                AudioSource.PlayClipAtPoint(Golpe, transform.position, 3f);
                DestruirEnemigo();
                StatsPlayer statsP = player.GetComponent <StatsPlayer>();
                statsP.sumarScore();
            }
        }
    }
Esempio n. 2
0
 private void Start()
 {
     minutos = 0;
     player  = GameObject.FindGameObjectWithTag("Player");
     sPlayer = player.GetComponent <StatsPlayer>();
     disp    = player.GetComponent <Disparar>();
 }
Esempio n. 3
0
 void Start()
 {
     stop        = false;
     walking     = GetComponent <NetworkPlayer>();
     unitparent  = GetComponentInParent <StatsPlayer>();
     targetIndex = 0;
 }
Esempio n. 4
0
        public frmGame(string name)
        {
            InitializeComponent();

            playerName = name;

            StatsPlayer currentPlayer = StatsPlayer.SearchForExistingUser(name);
        }
Esempio n. 5
0
    void Update()
    {
        try
        {
            proy2 = GameObject.FindGameObjectWithTag("Proyectil2");
        }
        catch
        {
            return;
        }

        CheckProyectil2();

        if (vida <= 0)
        {
            AudioSource.PlayClipAtPoint(MuereXProyectil, transform.position, 3f);
            Destroy(this.gameObject, 0);
            GameObject  aux    = Instantiate(explosionMuerte, transform.position, transform.rotation);
            StatsPlayer statsP = player.GetComponent <StatsPlayer>();
            statsP.sumarScore();
        }

        if (golpeado == false)
        {
            rb.velocity = 1 * transform.up * velocidad;
        }
        else
        {
            if (timerGolpeado < 0)
            {
                golpeado      = false;
                timerGolpeado = 0.4f;
                sr.color      = ColorInicial;
            }
            else
            {
                timerGolpeado -= Time.deltaTime;
            }
        }

        CheckProyectil2();
    }
Esempio n. 6
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "EnemyAttack")
        {
            /*if (isColliding == true) {
             *      Debug.Log("Hero isColliding already true");
             *      return;
             * }
             * else {
             *      Debug.Log("Hero isColliding is now true");
             *      isColliding = true;*/
            StatsPlayer.DamageFatigue(other.GetComponentInParent <StatsEnemy>().damage);
            HPParent.UpdateFatigueBar();

            if (StatsPlayer.currentFatigue >= StatsPlayer.maxFatigue)
            {
                Debug.Log("You have become physically exhausted and cannot fight");
                arenaManager.ActivityFailed();
            }
            //}
        }
    }
Esempio n. 7
0
 /// <summary>
 /// Constructor for the main form
 /// </summary>
 public frmGame()
 {
     InitializeComponent();
     playerName = "Player 1";
     StatsPlayer currentPlayer = new StatsPlayer(playerName);
 }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        animator = GetComponent <Animator>();
        sprite   = GetComponent <SpriteRenderer>();

        animatorHead = head1.GetComponent <Animator>();
        spriteHead   = head1.GetComponent <SpriteRenderer>();
        transHead    = head1.GetComponent <Transform>();

        unitparent = GetComponentInParent <StatsPlayer>();

        head   = new Dictionary <int, string>();
        normal = new Dictionary <int, string>();
        walk   = new Dictionary <int, string>();
        atk    = new Dictionary <int, string>();
        battle = new Dictionary <int, string>();

        head[1] = "headup";
        head[2] = "head3.4";
        head[3] = "headleft";
        head[4] = "head3.4back";
        head[5] = "headback";
        head[6] = "head3.4back";
        head[7] = "headleft";
        head[8] = "head3.4";

        normal[1] = "Monkup";
        normal[2] = "Monk3.4";
        normal[3] = "Monkleft";
        normal[4] = "Monk3.4up";
        normal[5] = "Monkback";
        normal[6] = "Monk3.4up";
        normal[7] = "Monkleft";
        normal[8] = "Monk3.4";

        walk[1] = "Monkwalkup";
        walk[2] = "Monkwalk3.4";
        walk[3] = "Monkwalkleft";
        walk[4] = "Monkwalk3.4up";
        walk[5] = "Monkwalkback";
        walk[6] = "Monkwalk3.4up";
        walk[7] = "Monkwalkleft";
        walk[8] = "Monkwalk3.4";

        atk[1] = "monkatkup";
        atk[2] = "monkatkup";
        atk[3] = "monkatkup";
        atk[4] = "monkatkback";
        atk[5] = "monkatkback";
        atk[6] = "monkatkback";
        atk[7] = "monkatkback";
        atk[8] = "monkatkup";

        battle[1] = "monkbattleup";
        battle[2] = "monkbattleup";
        battle[3] = "monkbattleup";
        battle[4] = "monkbattleback";
        battle[5] = "monkbattleback";
        battle[6] = "monkbattleback";
        battle[7] = "monkbattleback";
        battle[8] = "monkbattleup";



        //DICCIONARIO DE DICCIONARIO

        AnimationList = new Dictionary <int, Dictionary <int, string> > {
            { 1, normal },
            { 2, walk },
            { 3, atk },
            { 4, battle }
        };
    }