示例#1
0
        private IEnumerator RunLandingSequence()
        {
            GameObject targetReticule = landingSpriteHandler.gameObject;
            GameObject dropPod        = baseSpriteHandler.gameObject;

            // Initialise target reticule for animating.
            targetReticule.LeanAlpha(0.25f, 0);
            targetReticule.transform.localScale = Vector3.one * 1.5f;

            // Initialise drop pod sprite to the start of falling animation.
            baseSpriteHandler.ChangeSprite((int)BaseSprite.Falling, false);
            dropPod.transform.localScale = Vector3.zero;
            Vector3 localPos = dropPod.transform.localPosition;

            localPos.y = DROP_HEIGHT;
            dropPod.transform.localPosition = localPos;
            registerObject.Passable         = true;

            // ClosetControl initialises, redisplaying the door, so wait a frame...
            yield return(WaitFor.EndOfFrame);

            doorSpriteHandler.PushClear(false);

            // Begin the drop animation.
            dropPod.LeanScale(Vector3.one, TRAVEL_TIME);
            dropPod.LeanMoveLocalY(0, TRAVEL_TIME);

            // Animate the target reticule.
            targetReticule.LeanScale(Vector3Int.one, TRAVEL_TIME / 2);
            targetReticule.LeanRotateZ(-270, TRAVEL_TIME);
            targetReticule.LeanAlpha(0.75f, TRAVEL_TIME / 2);

            yield return(WaitFor.Seconds(TRAVEL_TIME));

            // Swap to stationary drop pod.
            if (IsServer)
            {
                closetControl.ServerToggleLocked(false);
            }
            baseSpriteHandler.ChangeSprite((int)BaseSprite.Stationary, false);
            doorSpriteHandler.PushTexture(false);
            landingSpriteHandler.PushClear(false);
            registerObject.Passable = false;

            // Create a small explosion to apply damage to objects underneath.
            var matrixInfo = MatrixManager.AtPoint(WorldPosition, IsServer);

            Explosion.StartExplosion(registerObject.LocalPosition, EXPLOSION_STRENGTH, matrixInfo.Matrix);

            isLanding = false;
        }