示例#1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.blockattack(this, collparameters, blocked);

        rules.collisiondamage(sprayvars, collparameters, damage);
    }
示例#2
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.blockattack(this, collparameters, blocked);

        if (rules.collisiondamage(this, collparameters, tempdamage * transform.localScale.magnitude) && !canPassThroughBodies)
        {
            blocked();
        }
    }
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.blockattack(this, collparameters, blocked);

        if (rules.collisiondamage(orbitvars, collparameters, damage))
        {
            endenable();
        }
    }
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.blockattack(this, collparameters, blocked);


        if (changed)
        {
            rules.collisiondamage(this, collparameters, tempdamage);
        }
    }
示例#5
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        if (rules.collisiondamage(this, collparameters, damage))
        {
            if (canPush)
            {
                Vector3 targ_sub_pos  = collparameters.transform.position - movars.transform.position;
                Vector3 directionSpin = -mathlib.rotate90(targ_sub_pos);
                collparameters.vars.movars.push(push_distance, (targ_sub_pos + directionSpin).normalized);
            }
        }
    }
示例#6
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        if (rules.collisiondamage(this, collparameters, damage))
        {
            move collmovars = collision.getvars <move>();
            if (collmovars != null)
            {
                Audio.AddSoundToQueue(PushHitSoundIndex, collmovars.position);
                collmovars.push(push_distance, ((collision.transform.position - transform.position).normalized + 3f * direction).normalized);
            }
        }
    }
示例#7
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.blockattack(this, collparameters, blocked);

        if (rules.collisiondamage(this, collparameters, damage))
        {
            move collmovars = collision.getvars <move>();
            collmovars.push(10f, side * mathlib.rotate90(direction));
            //collmovars.push(10f, (collmovars.position - transform.position).normalized);
            //collmovars.push(10f, collision.transform.position - transform.position);

            //           collvars.control = collvars.controlpushed_once;
            //           collvars.endpos = colltr.position + 2f * radius * new Vector3(-direction.y, direction.x) * (float)side /*+ 0.2f * somefunctions.getunitvector2(colltr.position - transform.position)*/;
            Audio.AddSoundToQueue(punchhitSoundIndex, transform.position);
        }
    }
示例#8
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform == movars.transform)
        {
            return;
        }
        Collider2D      collider       = collision.collider;
        aboutcollisions collparameters = collider.GetComponent <aboutcollisions>();

        if (rules.collisiondamage(this, collparameters, ((chargingAI)vars).damage))
        {
            MyAudioSource audio = collider.GetComponent <MyAudioSource>();
            if (audio != null)
            {
                collider.GetComponent <MyAudioSource>().AudioQueue[0].Enqueue(collision.transform.position);
            }
            vars.lifevars.life = 0f;
        }
    }
示例#9
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.transform == movars.transform)
        {
            return;
        }

        /* if (collision.transform != globalvariables.playergameobject.transform.GetChild(0))
         * {
         *   Debug.Log("hmm", collision.gameObject);
         * }*/
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        if (rules.collisiondamage(this, collparameters, ((chargingAI)AIvars).damage))
        {
            MyAudioSource audio = collision.GetComponent <MyAudioSource>();
            if (audio != null)
            {
                collision.GetComponent <MyAudioSource>().AudioQueue[0].Enqueue(collision.transform.position);
            }
            AIvars.lifevars.life = 0f;
        }
    }
    void OnCollisionStay2D(Collision2D collision)
    {
        aboutcollisions collparameters = collision.collider.GetComponent <aboutcollisions>();
        //collision = collision.otherCollider;
        bool addPos = false;

        if (rules.collisiondamage(this, collparameters, 0f))
        {
            addPos = true;
        }
        else if (rules.blockattack(this, collparameters, blocked))
        {
            addPos = true;

            /*Debug.Log(collision.contactCount);
             * for (int i = 0; i < collision.contactCount; i++)
             * {
             *  Debug.Log(collision.GetContact(i).point);
             * }*/
        }
        if (addPos)
        {
            Vector2 transformpos2d = (Vector2)transform.position;
            Vector2 direction      = (Vector2)mathlib.polarvectdeg(angleDirection);
            float   mindistsq      = (collision.GetContact(0).point - transformpos2d).projectOnNormed(direction).sqrMagnitude;
            for (int i = 1; i < collision.contactCount; i++)
            {
                float tempdistsq = (collision.GetContact(i).point - transformpos2d).projectOnNormed(direction).sqrMagnitude;
                if (tempdistsq < mindistsq)
                {
                    mindistsq = tempdistsq;
                }
            }
            CollidedWith.Add(new CollidedWithInfo((float)System.Math.Sqrt(mindistsq), collparameters));
        }
    }
    void OnTriggerStay2D(Collider2D collision)
    {
        aboutcollisions collparameters = collision.GetComponent <aboutcollisions>();

        rules.collisiondamage(this, collparameters, damage);
    }
 public CollidedWithInfo(float dist, aboutcollisions coll)
 {
     this.dist = dist;
     this.coll = coll;
 }