Beispiel #1
0
    void GetRadius(Transform positronPosition, Transform antiprotonPosition)
    {
        Vector2 radiusVector = positronPosition.position - antiprotonPosition.position;

        radius = radiusVector.magnitude;
        orbit.EnterCollider(positronPosition, antiprotonPosition, electron.PositronFalling(currentPositron, positronTmpY));
        Destroy(col2D);
    }
Beispiel #2
0
    private void Update()
    {
        if (countdown)
        {
            antielectronRB.gravityScale = 0f;
            antielectronRB.velocity     = Vector2.zero;
        }
        else
        {
            antielectronRB.gravityScale = 5f;
            electron.PositronFalling(currentPositron, temporaryY);
            if ((electron.electron == null || orbitScript.electronInOrbit) && !positronCollision)
            {
                antielectronRB.gravityScale    = 0f;
                antielectronRB.velocity        = Vector2.zero;
                antielectronRB.angularVelocity = 0;
            }

            else if (electron.electron != null && !repulsion && !positronSuperposition && !positronCollision)
            {
                Vector2 direction = electronRB.position - antielectronRB.position;

                direction.Normalize();

                float rotateAmount = Vector3.Cross(direction, transform.up).z;

                antielectronRB.angularVelocity = -rotateAmount * rotateSpeed;

                antielectronRB.velocity = transform.up * speed;
            }

            if (positronSuperposition)
            {
                StartCoroutine(setSuperPosition(superpositioner, rotationAngle1, rotationAngle2));
            }

            if (destroy)
            {
                ParticleSystem.Instantiate(collisionParticle, transform.position, Quaternion.identity);
                Destroy(gameObject);
                Destroy(electron.electron);
            }
        }
    }