Пример #1
0
        void StackFallingLetter()
        {
            if (fallingLetter == null)
            {
                return;
            }

            fallingLetter.GetComponentInChildren <LetterObjectView>().Falling = false;
            fallingLetter.GetComponentInChildren <LetterObjectView>().SetState(LLAnimationStates.LL_idle);

            for (int i = 0; i < stackedLetters.Count; ++i)
            {
                stackedLetters[i].GetComponentInChildren <LetterObjectView>().SetState(LLAnimationStates.LL_still);
            }

            currentHeight += LETTER_HEIGHT;
            stackedLetters.Add(fallingLetter);
            var currentFallingLetter = fallingLetter;

            fallingLetter = null;
            Bounce();

            System.Action callback;
            if (releasedCallbacks.TryGetValue(currentFallingLetter, out callback))
            {
                releasedCallbacks.Remove(currentFallingLetter);
                callback();
            }
        }
Пример #2
0
        void UpdateFallingLetter(LivingLetterRagdoll letter)
        {
            remainingFallingTime -= Time.deltaTime;

            float passedTime = fallingTime - remainingFallingTime;

            letter.transform.position = transform.position + Vector3.up * (
                letterInitialFallSpeed * passedTime +
                fallingSpawnHeight + 0.5f * Physics.gravity.y * passedTime * passedTime
                );

            bool toStack = false;

            // Manage attaching
            if (stackedLetters.Count == 0)
            {
                toStack = (remainingFallingTime <= 0);
            }
            else
            {
                float fullHeight       = TowerFullHeight;
                float compressedHeight = lastCompressionValue * fullHeight;

                float currentFallHeight = letter.transform.position.y - transform.position.y - compressedHeight;
                //float totalFallHeight = fallingSpawnHeight - compressedHeight;

                toStack = (currentFallHeight <= 0);
            }

            // Stack it
            if (toStack)
            {
                StackFallingLetter();
            }
        }
Пример #3
0
        void SpawnLetter(LivingLetterRagdoll letter)
        {
            remainingFallingTime      = fallingTime;
            letter.transform.position = transform.position + fallingSpawnHeight * Vector3.up;
            letter.gameObject.SetActive(true);
            fallingLetter = letter;
            letter.GetComponentInChildren <LetterObjectView>().Falling = true;
            spawnTimer = 0;

            EA4S.Tobogan.ToboganConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.UIPopup);
        }