예제 #1
0
        public void updateTime(float timeSinceLastFrameUpdate)
        {
            aerialAnimation1.updateTime(timeSinceLastFrameUpdate);
            aerialAnimation1.animate();

            aerialAnimation2.updateTime(timeSinceLastFrameUpdate);
            aerialAnimation2.animate();

            if (backgroundDummy)
            {
                japanFlagState.AddTime(timeSinceLastFrameUpdate);
            }
            else
            {
                for (int i = 0; i < storagePlanes.Count; i++)
                {
                    storagePlanes[i].updateTime(timeSinceLastFrameUpdate);
                    if (storagePlanes[i].AnimationState.AnimationName == "die" && storagePlanes[i].AnimationState.HasEnded)
                    {
                        storagePlanes[i].MinimapItem.Hide();
                        storagePlanes.Remove(storagePlanes[i]);
                    }
                }

                for (int i = 0; i < crewAnimationStates.Length; i++)
                {
                    crewAnimationStates[i].AddTime(timeSinceLastFrameUpdate);
                }

                // hangar
                if (isHangaringPlane)
                {
                    float targetDepth = hangarDepth * hangaringDirection;
                    float progress    = 1 - (targetDepth - carrierHangarNode.Position.y) / targetDepth;
                    float step        = 3.0f * timeSinceLastFrameUpdate * hangaringDirection; //* Math.Cos(Math.HALF_PI * progress);

                    progress = Math.Abs(progress);
                    step    *= 1 / (1 + (float)System.Math.Pow((-1.5f + 3.0f * progress), 2)) * 0.75f; // p³ynne przyspieszenie i hamowanie wg. pochodniej arctan ktora wynosi 1 / (1 + x^2)

                    carrierHangarNode.Position = carrierHangarNode.Position + new Vector3(0, step, 0);
                    hangarPlane.Plane.Bounds.Move(0, step);

                    if (hangaringDirection == -1)
                    {
                        // opuszczanie
                        if (carrierHangarNode.Position.y < targetDepth)
                        {
                            hangarPlane.Plane.Bounds.Move(0, carrierHangarNode.Position.y - targetDepth);
                            carrierHangarNode.SetPosition(0, targetDepth, 0);
                            isHangaringPlane = false;
                        }
                    }
                    else
                    {
                        // podnoszenie
                        if (carrierHangarNode.Position.y >= 0)
                        {
                            carrierHangarNode.SetPosition(0, 0, 0);
                            hangarPlane.Plane.Bounds.Move(0, -carrierHangarNode.Position.y);
                            isHangaringFinished = true;
                            isHangaringPlane    = false;
                        }
                    }
                }



                if (isCatchingPlane)
                {
                    activateClosestArrestingWires(planeBeingCaught); // zaczepiaj samolot o kolejne liny
                    for (int i = 0; i < activeArrestingWires.Count; i++)
                    {
                        arrestingWiresH[i] =
                            animateArrestingWire(activeArrestingWires[i],
                                                 planeBeingCaught.RearWheelInnerNode._getDerivedPosition().x);
                    }
                }
                if (isReleasingPlane)
                {
                    if (!shouldStopReleasingPlane())
                    {
                        for (int i = 0; i < activeArrestingWires.Count; i++)
                        {
                            animateArrestingWire(
                                activeArrestingWires[i],
                                activeArrestingWires[i]._getDerivedPosition().x - arrestingWiresH[i]
                                );
                            arrestingWiresH[i] *= (1 - 10 * timeSinceLastFrameUpdate);
                            // 0.99f; - wymuszamy zmniejszenie wysokosci trojkatow
                        }
                    }
                    else
                    {
                        // koniec
                        finishReleasingPlane();
                    }
                }
            }
        }
예제 #2
0
 public override void updateTime(float timeSinceLastFrameUpdate)
 {
     torpedoAnimation.updateTime(timeSinceLastFrameUpdate);
     torpedoAnimation.animate();
 }
예제 #3
0
 public override void updateTime(float timeSinceLastFrameUpdate)
 {
     missileAnimation.updateTime(timeSinceLastFrameUpdate);
     missileAnimation.animate();
 }