Beispiel #1
0
 public void UpdateRotation(float a)
 {
     angle              = a;
     direction          = CS_Utils.DegreeToPoint(a);
     transform.rotation = Quaternion.Euler(0.0f, 0.0f, a - 90);
     rb.velocity        = direction * speed;
 }
    public override void SpecialCollision(Collision2D collision)
    {
        Rigidbody2D             rb = GetComponent <Rigidbody2D>();
        CS_Projectile_Collision pc = GetComponent <CS_Projectile_Collision>();

        float magnitude = rb.velocity.magnitude;
        float angle     = CS_Utils.PointToDegree(rb.velocity);

        CS_Projectile_Collision.Owner owner = pc.GetOwner();

        float   angle1    = (angle + 45);
        Vector2 velocity1 = CS_Utils.DegreeToPoint(angle1);

        CreateChild(velocity1, magnitude, owner);

        float   angle2    = (angle - 45);
        Vector2 velocity2 = CS_Utils.DegreeToPoint(angle2);

        CreateChild(velocity2, magnitude, owner);

        Destroy(gameObject);
    }