// Start is called before the first frame update void Start() { moonDamageTaker = moon.GetComponent <MoonDamageTaker>(); audioManager = AudioManager.instance; spriteFlasher = GetComponent <SpriteFlasher>(); eye = GetComponent <MoonEye>(); }
// Start is called before the first frame update void Start() { health = GetComponent <Health>(); iframes = GetComponent <IFrames>(); audioManager = AudioManager.instance; spriteFlasher = GetComponent <SpriteFlasher>(); levelLoader = FindObjectOfType <LevelLoader>(); }
// Start is called before the first frame update void Start() { objectToDamage = objectToDamage != null ? objectToDamage : gameObject; objectToFlash = objectToFlash != null ? objectToFlash : gameObject; health = objectToDamage.GetComponent <Health>(); audioManager = AudioManager.instance; spriteFlasher = objectToFlash.GetComponent <SpriteFlasher>(); }
private void CreateFillBarGradient() { Texture2D fillBarBackgroundTexture = _contentManager.Load <Texture2D>(AssetManager.FillBarBackground); Texture2D fillBarFrameTexture = _contentManager.Load <Texture2D>(AssetManager.FillBarFrame); Texture2D fillBarGradientTexture = _contentManager.Load <Texture2D>(AssetManager.FillBarGradient); Sprite fillBarBackground = new Sprite(fillBarBackgroundTexture); Sprite fillBarFrame = new Sprite(fillBarFrameTexture); _fillBarGradient = new Sprite(fillBarGradientTexture); fillBarBackground.SetOriginCenter(); fillBarFrame.SetOriginCenter(); _fillBarGradient.Origin = new Vector2(_fillBarGradient.TextureWidth / 2.0f, 0); fillBarFrame.Scale = 0.5f; fillBarBackground.Scale = 0.5f; _fillBarGradient.Scale = 0.5f; _fillBarVertical = new FillBarVertical(); _fillBarVertical.Initialize(fillBarFrame, fillBarBackground, _fillBarGradient, GameInfo.TotalGameTime); float barXPosition = GameInfo.FixedWindowWidth / 2.0f + GameInfo.CenterBoardWidth / 2.0f; fillBarBackground.Position = new Vector2(barXPosition, GameInfo.FixedWindowHeight / 2.0f); fillBarFrame.Position = new Vector2(barXPosition, GameInfo.FixedWindowHeight / 2.0f); _fillBarGradient.Position = new Vector2(barXPosition, GameInfo.FixedWindowHeight / 2.0f - _fillBarGradient.ScaledHeight / 2.0f); Texture2D whitePixel = _contentManager.Load <Texture2D>(AssetManager.WhitePixel); _fillBarFlasher = new SpriteFlasher(whitePixel, true); _fillBarFlasher.Origin = new Vector2(_fillBarFlasher.TextureWidth / 2.0f, 0); _fillBarFlasher.SetSize((int)_fillBarGradient.Width, 0); _fillBarFlasher.StartFlashing(GameInfo.InitialBarFlashRate, GameInfo.FlashBarMinAlpha, GameInfo.FlashBarMaxAlpha); _fillBarFlasher.Position = new Vector2(barXPosition, GameInfo.FixedWindowHeight / 2.0f - _fillBarGradient.ScaledHeight / 2.0f); _fillBarFlasher.SetSpriteColor(GameInfo.FlashBarColor); Texture2D fillBarPointer = _contentManager.Load <Texture2D>(AssetManager.FillBarPointer); _fillBarPointer = new Sprite(fillBarPointer); _fillBarPointer.SetOriginCenter(); _fillBarPointer.Scale = 0.5f; _fillBarPointerInitialPosition = new Vector2(barXPosition + 35, GameInfo.FixedWindowHeight / 2.0f - _fillBarGradient.ScaledHeight / 2.0f); _fillBarPointerFinalPosition = new Vector2(barXPosition + 35, GameInfo.FixedWindowHeight / 2.0f + _fillBarGradient.ScaledHeight / 2.0f); _fillBarPointer.Position = _fillBarPointerInitialPosition; }
protected virtual void Start() { //DamageFlashPool = new ObjectPool(DamageFlash); //OrangeSpatterPool = new ObjectPool(OrangeSpatter); //HitPuffPool = new ObjectPool(HitPuff); /*if (InfectedHitPool == null && ) * { * InfectedHitPool = new ObjectPool(Assets.EffectAssets.UninfectedHitPrefab, PoolLoadType.Local); * }*/ flasher = GetComponent <SpriteFlasher>(); }
private IEnumerator StartFight() { // Disable satellites until the moon is in position if (satelliteCoordinator) { satelliteCoordinator.DisableSatellites(); } yield return(new WaitForSeconds(delayUntilFightStarts)); pathMovement = GetComponent <PathMovement>(); // Start the music coroutine StartCoroutine(PlayBossAudio()); // Move the moon into position if (pathMovement) { while (!pathMovement.finishedMoving) { yield return(new WaitForSeconds(.5f)); pathMovement.movementSpeed *= .92f; } } yield return(new WaitForSeconds(delayUntilShieldStartsLowering)); // Flash then lower the shield SpriteFlasher spriteFlasher = invulnerabilityShield.GetComponent <SpriteFlasher>(); spriteFlasher.Flash(); // Wait for the flashing to stop yield return(new WaitForSeconds(spriteFlasher.GetFlashDuration())); invulnerabilityShield.SetActive(false); yield return(new WaitForSeconds(delayUntilAttackStartsAfterShieldIslowered)); if (satelliteCoordinator) { satelliteCoordinator.InitializeSatellites(); } StartCoroutine(CannonAttack(new MoonCannon[] { eyeCannon }, delayBetweenEyeCannonAttacks)); StartCoroutine(CannonAttack(heavyCannons, delayBetweenHeavyCannonAttacks)); StartCoroutine(CannonAttack(lightCannons, delayBetweenLightCannonAttacks)); StartCoroutine(SatelliteAttack()); }
void Start() { NormalFlings = Flings.CreateNormalFlings(); if (UninfectedHitPool == null) { UninfectedHitPool = ObjectPool.Create(Assets.EffectAssets.UninfectedHitPrefab); } flasher = GetComponent <SpriteFlasher>(); if (DamageSound == null) { DamageSound = Assets.AudioAssets.DamageEnemy; } }
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)); } } } } }