Наследование: MonoBehaviour
Пример #1
0
 public static void Update()
 {
     WhiteFlash.Update();
     RewindEffect.Update();
     BlackFade.Update();
     Heart.Update(GameWorld.GetPlayers()[0]);
     Coin.Update(GameWorld.GetPlayers()[0]);
 }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        selfFlash = GetComponent <WhiteFlash>();

        if (GameObject.FindWithTag("PredatorSpawner"))
        {
            predatorCount = GameObject.FindWithTag("PredatorSpawner").GetComponent <PredatorCount>();
            if (!boss)
            {
                predatorCount.IncCount();
            }
        }
    }
Пример #3
0
 public static void Draw(SpriteBatch spriteBatch)
 {
     WhiteFlash.Draw(spriteBatch);
     RewindEffect.Draw(spriteBatch);
     ColoredCorners.Draw(spriteBatch);
     if (TMBAW_Game.CurrentGameMode == GameMode.Play && !StoryTracker.InCutscene)
     {
         Heart.Draw(spriteBatch);
         Coin.Draw(spriteBatch);
     }
     DarkBackground.Draw(spriteBatch);
     BlackFade.Draw(spriteBatch);
     BlackBars.Draw(spriteBatch);
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     flash = GetComponent<WhiteFlash>();
     startTime = Time.time;
 }
Пример #5
0
 public static void FlashWhite()
 {
     WhiteFlash.Start();
 }
Пример #6
0
        private static IEnumerator TeleportRoutine(GameObject entity, Vector3 Destination, float teleInTime, float teleOutTime, Color teleportColor, bool flashSprite, bool playEffects, float audioPitch, SpriteRenderer sprite, SpriteFlasher flasher, float storedAlpha)
        {
            if (teleInTime == 0f && teleOutTime == 0f)
            {
                var originalPosition = entity.transform.position;
                entity.transform.position = Destination;

                if (playEffects)
                {
                    SpawnTeleportGlow(Destination, teleportColor);

                    SpawnTeleportLine(originalPosition, Destination, teleportColor);

                    SpawnWhiteFlash(teleportColor, originalPosition);
                }

                PlayTeleportSound(Destination, audioPitch);
            }
            else
            {
                if (flashSprite)
                {
                    flasher.DoFlash(teleInTime, 0.0f, 0.8f, teleportColor, 10f);
                }
                WhiteFlash whiteFlash = null;

                if (playEffects)
                {
                    whiteFlash = SpawnWhiteFlash(teleportColor, entity.transform.position);
                    whiteFlash.transform.parent = entity.transform;
                }
                if (teleInTime > 0f)
                {
                    //yield return new Awaiters.WaitForSeconds(teleInTime);
                    yield return(new WaitForSeconds(teleInTime));
                }
                if (playEffects)
                {
                    whiteFlash.transform.parent   = null;
                    whiteFlash.transform.position = entity.transform.position;
                }
                if (teleOutTime == 0f)
                {
                    entity.transform.position = Destination;
                    if (flashSprite)
                    {
                        flasher.StopFlashing();
                        flasher.FlashIntensity = 0f;
                    }

                    var originalPosition = entity.transform.position;

                    if (playEffects)
                    {
                        SpawnTeleportGlow(Destination, teleportColor);

                        SpawnTeleportLine(originalPosition, Destination, teleportColor);
                    }

                    PlayTeleportSound(Destination, audioPitch);
                    //var teleportSound = HollowPlayer.Play(AudioAssets.Teleport, Destination, 1f, AudioChannel.Sound);

                    //teleportSound.AudioSource.pitch = audioPitch;
                }
                else
                {
                    if (flashSprite)
                    {
                        flasher.StopFlashing();
                        flasher.FlashIntensity = 0.8f;
                        flasher.FlashColor     = teleportColor;
                    }

                    float currentWarpTime = WARP_TIME;

                    if (teleOutTime < WARP_TIME)
                    {
                        currentWarpTime = teleOutTime;
                    }

                    float fadeOutTime = currentWarpTime / 2f;

                    float fadeOutTimer = 0f;

                    var originalPosition = entity.transform.position;

                    if (playEffects)
                    {
                        SpawnTeleportGlow(Destination, teleportColor);

                        /*var glow = GameObject.Instantiate(EffectAssets.TeleportGlowPrefab, new Vector3(Destination.x, Destination.y, Destination.z - 0.1f), Quaternion.identity);
                         * glow.GetComponent<SpriteRenderer>().color = Color.Lerp(teleportColor,Color.white,0.5f);*/

                        SpawnTeleportLine(originalPosition, Destination, teleportColor);

                        /*var teleLine = GameObject.Instantiate(EffectAssets.TeleLinePrefab, Vector3.Lerp(originalPosition, Destination, 0.5f), Quaternion.identity);
                         * LookAt(teleLine, Destination);
                         * teleLine.transform.localScale = new Vector3(Vector3.Distance(originalPosition, Destination), teleLine.transform.localScale.y, teleLine.transform.localScale.z);*/

                        //var mainModule = teleLine.GetComponent<ParticleSystem>().main;
                        //mainModule.startColor = Color.Lerp(teleportColor, Color.white, 0.5f);
                    }
                    PlayTeleportSound(Destination, audioPitch);
                    //var teleportSound = HollowPlayer.Play(AudioAssets.Teleport, Destination, 1f, AudioChannel.Sound);
                    //teleportSound.AudioSource.pitch = audioPitch;

                    while (fadeOutTimer < fadeOutTime)
                    {
                        yield return(null);

                        fadeOutTimer += Time.deltaTime;
                        if (fadeOutTimer > fadeOutTime)
                        {
                            fadeOutTimer = fadeOutTime;
                        }
                        if (playEffects)
                        {
                            sprite.color = new Color(sprite.color.r, sprite.color.g, sprite.color.b, Mathf.Lerp(storedAlpha, 0f, fadeOutTimer / fadeOutTime));
                        }
                    }

                    entity.transform.position = Destination;

                    float fadeInTime = currentWarpTime - fadeOutTime;

                    float fadeInTimer = 0f;

                    if (playEffects)
                    {
                        flasher.DoFlash(0.0f, teleOutTime, 0.8f, teleportColor, 0f);
                    }

                    while (fadeInTimer < fadeInTime)
                    {
                        yield return(null);

                        fadeInTimer += Time.deltaTime;
                        if (fadeInTimer > fadeInTime)
                        {
                            fadeInTimer = fadeInTime;
                        }
                        if (playEffects)
                        {
                            sprite.color = new Color(sprite.color.r, sprite.color.g, sprite.color.b, Mathf.Lerp(0f, storedAlpha, fadeInTimer / fadeInTime));
                        }
                    }
                }
            }
        }