Esempio n. 1
0
 /// <summary>
 /// Warps gravity body to the target wormhole
 /// </summary>
 /// <param name="bodyToWarp">Gravity Body to warp</param>
 /// <param name="bodyGameObject">GameOBject of gravity body (GO could be parent of gravityBody) </param>
 private void WarpToTarget(GravityBody bodyToWarp, GameObject bodyGameObject) {
     Vector2 randomDirection = Random.insideUnitCircle;
     //Disable collision and teleport
     bodyToWarp.DisableCollision(2f);
     ToggleTrailRenderer(bodyGameObject, false);
     bodyGameObject.transform.position = targetWormhole.warpPosition + (Vector3)randomDirection * 0f;
     ToggleTrailRenderer(bodyGameObject, true);
     //Apply Force
     bodyToWarp.Velocity = randomDirection * EXPULSION_FORCE;
     bodyToWarp.ResetGravityObjects();
     //Spawn Visuals
     Instantiate(FX_Warp_In, transform.position, Quaternion.identity);
     Instantiate(FX_Warp_Out, targetWormhole.transform.position, Quaternion.identity);
 }