Пример #1
0
    public void OnTriggerExit2D(Collider2D other)
    {
        DelayField delayField = other.GetComponent <DelayField>();

        if (delayField)
        {
            delayFieldsImIn.Remove(delayField);
        }

        GravityField gravityField = other.GetComponent <GravityField>();

        if (gravityField)
        {
            gravityFieldsImIn.Remove(gravityField);
        }

        RepulseField repulseField = other.GetComponent <RepulseField>();

        if (repulseField)
        {
            repulseFieldsImIn.Remove(repulseField);
        }
    }
Пример #2
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        DelayField delayField = collision.GetComponent <DelayField>();

        if (delayField)
        {
            delayFieldsImIn.Add(delayField);
        }

        GravityField gravityField = collision.GetComponent <GravityField>();

        if (gravityField)
        {
            gravityFieldsImIn.Add(gravityField);
        }

        RepulseField repulseField = collision.GetComponent <RepulseField>();

        if (repulseField)
        {
            repulseFieldsImIn.Add(repulseField);
        }
    }