private void Awake()
 {
     if (flash == null)
     {
         flash = this;
     }
 }
Exemplo n.º 2
0
    //OnCollisionEnter will only be called when the other collider has a rigidbody, like our ball has
    private void OnCollisionEnter(Collision c)
    {
        //We know there is only one ScreenFlash script in the scene so its safe to assume the one we get is the one we want
        ScreenFlash flasher = FindObjectOfType(typeof(ScreenFlash)) as ScreenFlash;

        //Start the flash
        flasher.Flash();
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     HealthBar.HealthMax     = health;
     HealthBar.HealthCurrent = health;
     myRender = GetComponent <Renderer>();
     sf       = GetComponent <ScreenFlash>();
     rb2d     = GetComponent <Rigidbody2D>();
 }
Exemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     HealthBar.HealthMax     = health;
     HealthBar.HealthCurrent = health;
     myRender          = GetComponent <Renderer>();
     anim              = GetComponent <Animator>();
     sf                = GetComponent <ScreenFlash>();
     rb2d              = GetComponent <Rigidbody2D>();
     polygonCollider2D = GetComponent <PolygonCollider2D>();
 }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     Fox_Health.HealthMax     = health;
     Fox_Health.HealthCurrent = health;
     animator = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();
     flash    = GameObject.FindGameObjectWithTag("ScreenFlash").GetComponent <ScreenFlash>();
     capsule  = GetComponent <CapsuleCollider2D>();
     box      = GetComponent <BoxCollider2D>();
     renderer = GetComponent <Renderer>();
 }
Exemplo n.º 6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        DontDestroyOnLoad(gameObject);
        previousRealtimeSinceStartup = Time.realtimeSinceStartup;
    }
Exemplo n.º 7
0
    private void Start()
    {
        sound = FindObjectOfType <SoundEffects>();
        deck  = FindObjectOfType <Deck>();
        deck.ResetDecks();
        healthBar.maxValue = health;
        healthBar.value    = health;

        maxHealth      = health;
        spellCards     = FindObjectOfType <GenerateSpellCards>();
        healhText.text = "<b>Health </b>" + health + " / " + maxHealth;
        screenShake    = FindObjectOfType <ScreenShake>();
        screenFlash    = FindObjectOfType <ScreenFlash>();
    }
Exemplo n.º 8
0
    public override void Die()
    {
        base.Die();

        Player.playerHealth.SetInvulnerable(8);

        ScreenFlash.Flash(0.5f);
        CameraShake.Shake(3f, 1f);

        LevelHandler.ClearEnemiesAndProjectiles();
        spikeContainer.SetActive(false);
        foreach (GameObject g in turrets)
        {
            g.GetComponent <Tile>().isTileEnabled = false;
        }
        turretContainer.SetActive(false);
    }
Exemplo n.º 9
0
    public void GroundRemoved()
    {
        if (--groundsNeeded <= 0)
        {
            GetComponent <LevelManager>().LevelComplete();
        }

        groundsLeftText.text = "" + groundsNeeded;
        float percentComplete = 1 - 1.0f * groundsNeeded / Mathf.FloorToInt(totalGrounds * percentGroundsNeeded);

        //  Camera.main.backgroundColor = percentComplete * levelCompleteColor + (1 - percentComplete) * allDesertSkyColor;
        planetAtmosphereMat.SetColor("_AtmoColor", atmosphereGradient.Evaluate(percentComplete));
        planetAtmosphereMat.SetFloat("_Size", atmosphereSizeCurve.Evaluate(percentComplete));

        ScreenFlash sFlash = Object.FindObjectOfType <ScreenFlash>();

        if (sFlash)
        {
            sFlash.ForestComplete();
        }
    }
Exemplo n.º 10
0
    private void SetPhase(int phase)
    {
        curPhase = phase;
        switch (curPhase)
        {
        case 0:
            curEnemySpawn = slime0Prefab;
            break;

        case 1:
            health = phase1Cutoff;
            SetShieldStatus(true);

            ScreenFlash.Flash(0.5f);

            curEnemySpawn = slime1Prefab;
            spikeContainer.SetActive(true);

            break;

        case 2:
            health = phase2Cutoff;
            SetShieldStatus(true);

            ScreenFlash.Flash(0.5f);

            curEnemySpawn = slime2Prefab;
            turretContainer.SetActive(true);
            foreach (GameObject g in turrets)
            {
                g.GetComponent <Tile>().isTileEnabled = true;
            }

            break;
        }
    }
Exemplo n.º 11
0
 void Awake()
 {
     _instance     = this;
     myCanvasGroup = GetComponent <CanvasGroup>();
 }
Exemplo n.º 12
0
 void Awake()
 {
     playerManager = FindObjectOfType <PlayerManager>();
     screenFlash   = GetComponent <ScreenFlash>();
 }
Exemplo n.º 13
0
 void Awake()
 {
     instance    = this;
     canvasGroup = GetComponent <CanvasGroup>();
     img         = GetComponent <Image>();
 }
        public override void Process()
        {
            if (TimeCircuitsBroken && !Main.PlayerPed.IsInVehicle())
            {
                var dist = Main.PlayerPed.Position.DistanceToSquared(Vehicle.Bones["bonnet"].Position);

                if (!(dist <= 2f * 2f))
                {
                    return;
                }

                Utils.DisplayHelpText(Game.GetLocalizedString("BTTFV_Repair_TimeCircuits"));

                if (Game.IsControlJustPressed(GTA.Control.Context))
                {
                    Mods.Hoodbox = ModState.On;
                }
            }

            if (_hasBeenStruckByLightning && _flashes <= 3)
            {
                if (Game.GameTime > _nextFlash)
                {
                    // Flash the screen
                    ScreenFlash.FlashScreen(0.25f);

                    // Update _flashes count
                    _flashes++;

                    // Update next flash
                    _nextFlash = Game.GameTime + 650;

                    // Dont do it anymore if flashed enough times
                    if (_flashes > 3)
                    {
                        _flashes = 0;
                        _hasBeenStruckByLightning = false;
                    }
                }

                if (IsFlying && Game.GameTime > _nextForce)
                {
                    Vehicle.ApplyForce(Vector3.RandomXYZ() * 3f, Vector3.RandomXYZ());

                    _nextForce = Game.GameTime + 100;
                }

                return;
            }

            if (!ModSettings.LightningStrikeEvent || World.Weather != Weather.ThunderStorm || TimeCircuits.IsTimeTraveling || TimeCircuits.IsReentering || Game.GameTime < _nextCheck)
            {
                return;
            }

            if ((Mods.Hook == HookState.On && Vehicle.GetMPHSpeed() >= 88 && !IsFlying) | (Vehicle.HeightAboveGround >= 20 && IsFlying))
            {
                if (Utils.Random.NextDouble() < 0.2)
                {
                    Strike();
                }
                else
                {
                    _nextCheck = Game.GameTime + 10000;
                }
            }
        }
Exemplo n.º 15
0
        public override void Process()
        {
            _reentryTimer += Game.LastFrameTime;

            if (_reentryTimer > 2)
            {
                if (Vehicle.Driver == null)
                {
                    Vehicle.IsHandbrakeForcedOn = false;
                    Vehicle.SteeringAngle       = 0;
                }
            }

            if (!IsTimeTravelling)
            {
                return;
            }

            if (!Vehicle.IsVisible)
            {
                Vehicle.IsEngineRunning = false;
            }

            if (Vehicle == null)
            {
                return;
            }

            if (Game.GameTime < gameTimer)
            {
                return;
            }

            switch (_currentStep)
            {
            case 0:
                TimeCircuits.Delorean.LastVelocity = Vehicle.Velocity;

                TimeCircuits.WasOnTracks = TimeCircuits.IsOnTracks;

                if (IsOnTracks)
                {
                    TimeCircuits.GetHandler <RailroadHandler>().StopTrain();
                }

                // Set previous time
                PreviousTime = Utils.GetWorldTime();

                // Invoke delegate
                TimeCircuits.OnTimeTravel?.Invoke();

                if (!IsRemoteControlled && Vehicle.GetPedOnSeat(VehicleSeat.Driver) == Main.PlayerPed && (!CutsceneMode || Utils.IsPlayerUseFirstPerson()))
                {
                    // Create a copy of the current status of the Delorean
                    TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy;

                    timeTravelAudioInstant.Play();

                    if (Utils.IsPlayerUseFirstPerson())
                    {
                        _whiteSphere.SpawnProp();
                    }
                    else
                    {
                        ScreenFlash.FlashScreen(0.25f);
                    }

                    // Have to call SetupJump manually here.
                    TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);

                    Stop();

                    TimeCircuits.GetHandler <SparksHandler>().StartTimeTravelCooldown();

                    if (TimeCircuits.WasOnTracks)
                    {
                        TimeCircuits.GetHandler <RailroadHandler>().StartDriving(true);
                    }

                    if (!is99)
                    {
                        IsFueled = false;
                    }

                    TimeCircuits.GetHandler <FreezeHandler>().StartFreezeHandling(!is99);

                    if (Mods.Hoodbox == ModState.On && !TimeCircuits.IsWarmedUp)
                    {
                        TimeCircuits.GetHandler <HoodboxHandler>().SetInstant();
                    }

                    if (Mods.Hook == HookState.On)
                    {
                        Mods.Hook = HookState.Removed;
                    }

                    if (Mods.Plate == PlateType.Outatime)
                    {
                        Mods.Plate = PlateType.Empty;
                    }

                    // Invoke delegate
                    TimeCircuits.OnTimeTravelComplete?.Invoke();

                    // Stop handling
                    Stop();

                    //Add LastDisplacementCopy to remote Deloreans list
                    RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy);

                    return;
                }

                timeTravelAudioCutscene.Play();

                // Play the effects
                _timeTravelEffect.Play();

                // Play the light explosion
                _lightExplosion.Play();

                trails = FireTrailsHandler.SpawnForDelorean(
                    TimeCircuits,
                    is99,
                    (is99 || (Mods.HoverUnderbody == ModState.On && IsFlying)) ? 1f : 45,
                    is99 ? -1 : 15,
                    DeloreanType == DeloreanType.BTTF1, Mods.Wheel == WheelType.RailroadInvisible ? 75 : 50);

                // If the Vehicle is remote controlled or the player is not the one in the driver seat
                if (IsRemoteControlled || Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed)
                {
                    MPHSpeed = 0;

                    // Stop remote controlling
                    TimeCircuits.GetHandler <RcHandler>()?.StopRC();

                    // Add to time travelled list
                    RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.Copy);

                    Utils.HideVehicle(Vehicle, true);

                    gameTimer = Game.GameTime + 300;

                    _currentStep++;
                    return;
                }

                // Create a copy of the current status of the Delorean
                TimeCircuits.Delorean.LastDisplacementCopy = TimeCircuits.Delorean.Copy;

                if (Mods.HoverUnderbody == ModState.On)
                {
                    CanConvert = false;
                }

                Game.Player.IgnoredByPolice = true;

                Main.HideGui = true;

                Main.DisablePlayerSwitching = true;

                Utils.HideVehicle(Vehicle, true);

                TimeCircuits.Delorean.IsInTime = true;

                gameTimer = Game.GameTime + 300;

                _currentStep++;
                break;

            case 1:
                _timeTravelEffect.Stop();

                if (Vehicle.GetPedOnSeat(VehicleSeat.Driver) != Main.PlayerPed)
                {
                    DeloreanHandler.RemoveDelorean(TimeCircuits.Delorean, true, true);
                    return;
                }

                gameTimer = Game.GameTime + 3700;
                _currentStep++;

                break;

            case 2:
                Screen.FadeOut(1000);
                gameTimer = Game.GameTime + 1500;

                _currentStep++;
                break;

            case 3:
                TimeHandler.TimeTravelTo(TimeCircuits, DestinationTime);
                FireTrailsHandler.RemoveTrail(trails);

                gameTimer = Game.GameTime + 1000;

                _currentStep++;
                break;

            case 4:
                TimeCircuits.OnTimeTravelComplete?.Invoke();

                gameTimer = Game.GameTime + 2000;
                Screen.FadeIn(1000);

                _currentStep++;
                break;

            case 5:
                //Add LastDisplacementCopy to remote Deloreans list
                RemoteDeloreansHandler.AddDelorean(TimeCircuits.Delorean.LastDisplacementCopy);

                Reenter();

                ResetFields();
                break;
            }
        }
Exemplo n.º 16
0
 public static void SetScreenFlasher(GameObject s)
 {
     screenFlasher = s.GetComponent <ScreenFlash>();
 }
Exemplo n.º 17
0
 void Start()
 {
     instance = this;
     solidColor = new Texture2D(1, 1);
     SetTextureColor(color, 1);
 }