Ejemplo n.º 1
0
    public void Skill()
    {
        //photonView.RPC("RealSkill", PhotonTargets.All);
        //gameObject.GetComponent<MoveScript>().stopwalking();
        //gameObject.GetComponent<StealthScript>().StealthEnd();
        currentcooldown = 0;
        skillavaliable  = false;
        float   radius      = 1.5f;
        Vector2 actionplace = transform.position;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplace, radius);
        foreach (Collider2D hit in colliders)
        {
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                if (hit == gameObject.GetComponent <Collider2D>())
                {
                    hp.GetHurt(Mathf.Min(10, hp.currentHP - 1));
                }
                else
                {
                    hp.GetHurt(10);
                    Rigidbody2D rb = hit.GetComponent <Rigidbody2D>();
                    if (rb != null)
                    {
                        Vector2 explforce;
                        explforce = rb.position - actionplace;
                        hit.GetComponent <RBScript>().GetPushed(explforce.normalized * 15, 1f);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void RealSkill()
    {
        Fix64        ff           = (Fix64)bombforce;
        Vector2      actionplacev = transform.position;
        Fix64Vector2 actionplacef = (Fix64Vector2)actionplacev;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplacev, radius + 0.1f);
        foreach (Collider2D hit in colliders)
        {
            /*Fix64 dfs = ((Fix64Vector2)(Vector2)hit.transform.position - actionplacef).LengthSquare();
             * if (dfs > rfs)
             *  continue;*/
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                hp.GetHurt(damage);
                Rigidbody2D rb = hit.GetComponent <Rigidbody2D>();
                if (rb != null)
                {
                    Fix64Vector2 explforce;
                    explforce = (Fix64Vector2)rb.position - actionplacef;
                    hit.GetComponent <RBScript>().GetPushed(explforce.normalized() * ff, pushtime);
                }
            }
        }
    }
Ejemplo n.º 3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (!photonView.isMine)
        {
            return;
        }
        if (gameObject.GetComponent <DestroyScript>().selfprotect&& collision.gameObject == sender)
        {
            return;
        }

        /*if (selfprotect && collision.gameObject.GetComponent<ShieldScript>().sender == sender)
         *  return;*/
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            Vector2     explforce;
            Rigidbody2D selfrb = gameObject.GetComponent <Rigidbody2D>();
            explforce = rb.position - selfrb.position;
            collision.gameObject.GetComponent <RBScript>().GetPushed(explforce.normalized * bombpower, pushtime);
            //hp.GetKicked(explforce.normalized * bombpower);
            hp.GetHurt(bombdamage);
            Jumb();
            bonus = true;
        }
        if (selfbreak)
        {
            gameObject.GetComponent <DestroyScript>().Destroyself();
        }
    }
Ejemplo n.º 4
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            hp.GetHurt(leechdamage);
            sender.GetComponent <HPScript>().GetHurt(-leechdamage);
        }
        gameObject.GetComponent <DestroyScript>().Destroyself();
    }
Ejemplo n.º 5
0
    public void perSkill()
    {
        float   radius      = transform.lossyScale.x / 2;
        Vector2 actionplace = transform.position;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplace, radius);
        foreach (Collider2D hit in colliders)
        {
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                if (hp.gameObject == sender)
                {
                    hp.GetHurt(-powerpers * Time.fixedDeltaTime);
                }
                else
                {
                    hp.GetHurt(powerpers * Time.fixedDeltaTime);
                }
            }
        }
    }
Ejemplo n.º 6
0
    public void Skill()
    {
        //photonView.RPC("RealSkill", PhotonTargets.All);
        //gameObject.GetComponent<MoveScript>().stopwalking();
        //gameObject.GetComponent<StealthScript>().StealthEnd();
        currentcooldown = 0;
        skillavaliable  = false;
        float        radius      = 2;
        Vector2      actionplace = transform.position;
        Fix64        rfix        = (Fix64)4;
        Fix64Vector2 apf         = new Fix64Vector2(actionplace);

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplace, radius);
        foreach (Collider2D hit in colliders)
        {
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                if (hit == gameObject.GetComponent <Collider2D>())
                {
                    hp.GetHurt(Mathf.Min(10, hp.currentHP - 1));
                }
                else
                {
                    Rigidbody2D  rb        = hit.GetComponent <Rigidbody2D>();
                    Fix64Vector2 rbpf      = new Fix64Vector2(rb.position);
                    Fix64Vector2 explforce = rbpf - apf;
                    if (explforce.LengthSquare() > rfix)
                    {
                        continue;
                    }
                    hp.GetHurt(10);
                    hit.GetComponent <RBScript>().GetPushed(explforce.normalized() * (Fix64)9, 1f);
                }
            }
        }
    }
Ejemplo n.º 7
0
    public void rollSkill()
    {
        float   radius      = transform.lossyScale.x / 2;
        Vector2 actionplace = transform.position;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplace, radius);
        foreach (Collider2D hit in colliders)
        {
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                hp.GetHurt(rolldamage * Time.fixedDeltaTime);
            }
        }
    }
Ejemplo n.º 8
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //if (!photonView.isMine)
        //return;
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            Vector2     explforce;
            Rigidbody2D selfrb = gameObject.GetComponent <Rigidbody2D>();
            explforce = rb.position - selfrb.position;
            collision.gameObject.GetComponent <RBScript>().GetPushed((FixMath.Fix64Vector2)(explforce.normalized * bombpower), pushtime);
            hp.GetHurt(bombdamage);
        }
        gameObject.GetComponent <DestroyScript>().Destroyself();
    }
Ejemplo n.º 9
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (!CanDo)
        {
            return;
        }
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            Fix64Vector2 explforce;
            Rigidbody2D  selfrb = gameObject.GetComponent <Rigidbody2D>();
            explforce = (Fix64Vector2)rb.position - (Fix64Vector2)selfrb.position;
            collision.gameObject.GetComponent <RBScript>().GetPushed(explforce.normalized() * (Fix64)pushpower, pushtime);
            hp.GetHurt(pushdamage);
        }
        StopKick();
    }
Ejemplo n.º 10
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (!photonView.isMine)
        {
            return;
        }
        if (collision.gameObject == sender && gameObject.GetComponent <DestroyScript>().selfprotect)
        {
            return;
        }
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            hp.GetHurt(leechdamage);
            sender.GetComponent <HPScript>().GetHurt(-leechdamage);
        }
        gameObject.GetComponent <DestroyScript>().Destroyself();
    }
Ejemplo n.º 11
0
    //[PunRPC]
    public void RealSkill()
    {
        //gameObject.GetComponent<MoveScript>().stopwalking();
        float   radius      = transform.lossyScale.x / 2;
        Vector2 actionplace = transform.position;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(actionplace, radius);
        foreach (Collider2D hit in colliders)
        {
            HPScript hp = hit.GetComponent <HPScript>();
            if (hp != null)
            {
                hp.GetHurt(damage);
                Rigidbody2D rb = hit.GetComponent <Rigidbody2D>();
                if (rb != null)
                {
                    Vector2 explforce;
                    explforce = rb.position - actionplace;
                    hit.GetComponent <RBScript>().GetPushed(explforce.normalized * bombforce, pushtime);
                }
            }
        }
    }
Ejemplo n.º 12
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        /*if (gameObject.GetComponent<DestroyScript>().selfprotect && collision.gameObject == sender)
         *  return;*/
        /*if (selfprotect && collision.gameObject.GetComponent<ShieldScript>().sender == sender)
         *  return;*/
        Rigidbody2D rb = collision.gameObject.GetComponent <Rigidbody2D>();
        HPScript    hp = collision.gameObject.GetComponent <HPScript>();

        if (hp != null && rb != null)
        {
            Fix64Vector2 explforce;
            Rigidbody2D  selfrb = gameObject.GetComponent <Rigidbody2D>();
            explforce = (Fix64Vector2)rb.position - (Fix64Vector2)selfrb.position;
            collision.gameObject.GetComponent <RBScript>().GetPushed(explforce.normalized() * (Fix64)bombpower, pushtime);
            //hp.GetKicked(explforce.normalized * bombpower);
            hp.GetHurt(bombdamage);
        }
        if (selfbreak)
        {
            gameObject.GetComponent <DestroyScript>().Destroyself();
        }
    }