Example #1
0
    public IEnumerator DoProcessPreLaunch_Energy()
    {
        Debug.Log("Observe Energy of Gravity and Elastic Energy before launch");

        energyWidget.AttachToTransform(cannonBall.EnergyWidgetMarker_TopOffset);
        energyWidget.infoWidget.ToggleKineticInfo(false);
        energyWidget.Show();

        energyWidget.infoWidget.UpdateInfoWidget(cannonBall.Gravitational_Potential_Energy(), Kinetic_Energy_At_Launch(), null);

        CanProcessNextStep = false;
        yield return(StartCoroutine(DoLerpCameraToTransform(catapult.step1CamTransform)));

        CanProcessNextStep = true;

        // Position the Distance Gizmo and Rotate it around the Catapault arm to match the time at launch position of the cannonball
        distanceGizmo.transform.position = cannonBall.transform.position;
        distanceGizmo.transform.RotateAround(catapult.catapultArm.transform.position, -catapult.catapultArm.transform.up, catapult.DEFAULT_LAUNCH_ANGLE);
        distanceGizmo.transform.rotation   = Quaternion.identity;
        DistanceFromGround_At_TimeOFLaunch = distanceGizmo.transform.position.y - terrain.transform.position.y; // update the distance of the cannonball from the ground at time of launch
        distanceGizmo.Show();

        activeCoroutine = null;
    }