Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     terrain       = Terrain.GetReference();
     manager       = GameManager.GetReference();
     cameraEffects = CameraEffects.GetReference();
     PrevY         = transform.position.y;
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (ParticleTimerSeconds > 0)
        {
            ParticleTimer -= Time.deltaTime;
            if (ParticleTimer <= 0f)
            {
                ParticleTimerSeconds--;
                ParticleTimer = 1f;

                if (ParticleTimerSeconds > 4)
                {
                    int spark = Random.Range(0, SparkParticles.Count);
                    SparkParticles[spark].Play();
                    SparkSounds[spark].Play();
                }
                if (ParticleTimerSeconds == 4)
                {
                    for (int i = 0; i < ExplosionParticles.Count; i++)
                    {
                        ExplosionParticles[i].Play();
                    }
                    CameraEffects.GetReference().Shake(0.5f);
                    ExplosionAudio.Play();
                }

                if (ParticleTimerSeconds <= 1)
                {
                    SmokeParticles.Stop();
                }
            }
        }
    }
Exemplo n.º 3
0
        private IEnumerator StopTime()
        {
            isTimeStopped = true;

            CameraEffects.SetSepia(_saturationMultiplier);
            yield return(null);
        }
Exemplo n.º 4
0
    /// <summary>
    /// Abstract Callback Function to handle blocking and everything else with the Player Unit
    /// </summary>
    /// <returns></returns>
    public override callbackValue callbackDamageFnc()
    {
        // Add Charge because of Perfect blocking
        if (perfectBlockActive && isBlocking)
        {
            if (currentCharges < maxCharges)
            {
                setCharges(currentCharges + 1);
            }

            // Camera Shake
            CameraEffects.ShakeOnce(ShakeLength, ShakeStrength);

            sparksCharged.Clear();
            sparksCharged.Play();
            SoundManager.Instance.playRandomSFX(parrySFX, audioSource, 0.8f, 1.2f);
            SoundManager.Instance.playSFX(chargeSFX, audioSource, 0.8f, 1.2f);

            return(callbackValue.SUCCESS);
        }

        // Normal blocking
        else if (!perfectBlockActive && isBlocking)
        {
            sparks.Clear();
            sparks.Play();
            SoundManager.Instance.playRandomSFX(parrySFX, audioSource, 0.8f, 1.2f);

            return(callbackValue.NOTHING);
        }

        // No blocking
        return(callbackValue.FAILURE);
    }
Exemplo n.º 5
0
 private void Update()
 {
     if (energy <= 0f)
     {
         CameraEffects.Failure();
         enabled = false;
     }
     if (body.velocity.magnitude > .1f)
     {
         isIdle          = false;
         energy         -= body.velocity.magnitude / speed * Time.deltaTime;
         walkSoundTimer += Time.deltaTime * (body.velocity.magnitude / speed);
         if (walkSoundTimer >= .3f)
         {
             walkSoundSource.clip = RandomWalkSound(walkSounds);
             walkSoundSource.Play();
             walkSoundTimer = 0f;
         }
         animator.Play("Walk");
         sprite.flipX = body.velocity.x > 0;
     }
     else
     {
         if (walkSoundSource.isPlaying)
         {
             walkSoundSource.Stop();
         }
         walkSoundTimer = 1f;
         if (!isDamaged && !isIdle)
         {
             animator.Play("Idle");
             isIdle = true;
         }
     }
 }
Exemplo n.º 6
0
    public IEnumerator Die()
    {
        inputDelegate    = Empty;
        rotationDelegate = Empty;

        ledsIn.color = ledsOut.color = Color.black;
        GetComponent <Breakable>().Break(true);
        movementUpgradeObject.GetComponent <Breakable>().Break();
        attackUpgradeObject.GetComponent <Breakable>().Break();

        aim.gameObject.SetActive(false);

        CameraEffects cam = Camera.main.GetComponent <CameraEffects>();

        if (cam)
        {
            cam.StopAllCoroutines();
            cam.StartCoroutine(cam.Shake());
        }

        Time.timeScale = .01f;
        yield return(new WaitForSecondsRealtime(.3f));

        Time.timeScale = 1f;
    }
Exemplo n.º 7
0
 public static void Postfix(CameraEffects __instance)
 {
     if (Settings.Load(out SettingsStruct settings))
     {
         __instance.SwitchImageFilter(settings.filter);
     }
 }
Exemplo n.º 8
0
    void Start()
    {
        _menu = GetComponentInChildren <GameMenu>();
        _hud  = GetComponentInChildren <GameHud>();


        _camEffects    = Camera.main.GetComponent <CameraEffects>();
        _camController = Camera.main.GetComponent <CameraController>();

        _hud.FinalScoreMode(false);
        _hud.gameObject.SetActive(false);
        _menu.Show(OnStartNewGame, null);

        _introState = new IntroState(this)
        {
            TimeInState = 5, TimeAwake = 4f
        };
        _unarmedState             = new UnarmedState(this);
        _accState                 = new AccState(this);
        _powerUpState             = new PowerUpState(this);
        _blockadesAndEnemiesState = new BlockadeAndEnemiesState(this);
        _aliensState              = new AliensState(this);
        _pauseState               = new PauseState(this);
        _aliensFinalState         = new AliensFinalState(this);

        _accState.ExitState = _unarmedState;

        Spawner = new Spawner(GamePrefabs);
        Spawner.OnRewardEvent += (reward_pts) =>
        {
            pts += reward_pts;
            _hud.SetPoints(pts);
        };
    }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     ppEffects = GetComponent <CameraEffects>();
     magicTime = GetComponent <Image>();
     time      = player.magicTime;
     timeE     = player.magicTime;
 }
 protected override void Start()
 {
     player          = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     player2D        = player.gameObject.GetComponent <Player2D>();
     cameraEffects   = FindObjectOfType <CameraEffects>();
     dialogueManager = FindObjectOfType <DialogueManager>();
     base.Start();
 }
Exemplo n.º 11
0
    private void Start()
    {
        var am = FindObjectOfType <AudioManager>();

        eye = FindObjectOfType <CameraEffects>();
        am?.StopAllSound();
        am?.Play("Game Theme");
    }
Exemplo n.º 12
0
 private void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.tag == "Players")
     {
         col.gameObject.GetComponent <Rigidbody>().AddForce(transform.forward * Random.Range(350, 450));
         CameraEffects.ShakeOnce(0.5f, 3, new Vector3(2, 2, 2));
     }
 }
Exemplo n.º 13
0
 void Awake()
 {
     instance    = this;
     cam         = this.GetComponent <Camera>();
     originalPos = transform.localPosition;
     target      = GameObject.FindGameObjectWithTag("Player").transform;
     isFollow    = true;
 }
 public static CameraEffects GetReference()
 {
     if (reference == null)
     {
         reference = GameObject.Find("Cameras").GetComponent <CameraEffects>();
     }
     return(reference);
 }
Exemplo n.º 15
0
 void Start()
 {
     respawnPoint = GameObject.FindGameObjectWithTag("Respawn").transform;
     if (respawnPoint.position == Vector3.zero)
     {
         Debug.LogError("No Respawn In Scene");
     }
     cameraEffects = FindObjectOfType <CameraEffects>();
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     S           = this;
     startOffset = transform.position;
     curOffset   = startOffset;
     thisCamera  = GetComponent <Camera>();
     startSize   = thisCamera.orthographicSize;
     curSize     = startSize;
 }
Exemplo n.º 17
0
    IEnumerator dashEffect()
    {
        isDashing = true;
        num_of_jumps++;
        dashParticles.Play();

        if (Gamepad.current != null)
        {
            Gamepad.current.SetMotorSpeeds(.5f, .5f);
        }

        Vector2 direction = Vector3.zero;

        direction += controls.Creature.movement.ReadValue <Vector2>();

        if (direction == Vector2.zero)
        {
            direction += Vector2.up;
        }
        direction.Normalize();
        trail.SetActive(true);
        creature_rigid.velocity = direction * dashSpeed;
        float originalDrag        = creature_rigid.drag;
        float originalAngularDrag = creature_rigid.angularDrag;
        float originalGravity     = creature_rigid.gravityScale;

        creature_rigid.drag         = 0.0001f;
        creature_rigid.angularDrag  = 0f;
        creature_rigid.gravityScale = 0f;
        CameraEffects.ShakeOnce(0.3f, 10f);
        gameManager.playSound(MusicControl.SoundFX.Dash);
        yield return(new WaitForSeconds(dashTime * (0.75f)));

        creature_rigid.velocity = direction * (dashSpeed * .5f);
        creature_rigid.drag     = 0.01f;
        yield return(new WaitForSeconds(dashTime * (0.25f)));

        if (Gamepad.current != null)
        {
            Gamepad.current.SetMotorSpeeds(0f, 0f);
        }


        dashParticles.Stop();
        trail.SetActive(false);
        creature_rigid.velocity     = Vector2.zero;
        creature_rigid.drag         = originalDrag;
        creature_rigid.angularDrag  = originalAngularDrag;
        creature_rigid.gravityScale = originalGravity;
        isDashing = false;

        // if the creature didn't leave the platform than restore the jump
        if (direction.y < 0 && num_of_jumps == 1)
        {
            num_of_jumps--;
        }
    }
Exemplo n.º 18
0
    IEnumerator TestFade()
    {
        yield return(new WaitForSecondsRealtime(1));

        CameraEffects.StartFadeToBlack(() => { print("start finished"); });
        yield return(new WaitForSecondsRealtime(3));

        CameraEffects.StartFadeToGame(() => { print("end finished"); });
    }
Exemplo n.º 19
0
    protected override void SwitchEffect()
    {
        base.SwitchEffect();

        transform.parent.rotation = Quaternion.Euler(0, 0, angle);
        player.transform.rotation = Quaternion.Euler(0, 0, 0);
        CameraEffects.RotateFadeOut();
        EndSwitch();
    }
Exemplo n.º 20
0
    //BUILT-IN FUNCTIONS===================================================================================================================

    void Start()
    {
        CamFX = Camera.main.GetComponent <CameraEffects> ();

        standardRotation = transform.localRotation;
        desiredEuler     = standardRotation.eulerAngles;
        curEuler         = standardRotation.eulerAngles;
        standardPosition = transform.position;
        forwardAxis      = transform.forward;
    }
Exemplo n.º 21
0
    void Start()
    {
        GameObject playerGO = GameObject.FindGameObjectWithTag("Player");

        camera2DFollow  = Camera.main.GetComponent <Camera2DFollow>();
        player          = playerGO.GetComponent <Player>();
        player2D        = playerGO.GetComponent <Player2D>();
        dialogueManager = FindObjectOfType <DialogueManager>();
        cameraEffects   = FindObjectOfType <CameraEffects>();;
    }
Exemplo n.º 22
0
    private void SetInitialReferences()
    {
        playerMovement  = PlayerReference.GetComponent <PlayerMovement>();
        playerAnimation = PlayerReference.GetComponentInChildren <PlayerAnimation>();
        playerHealth    = PlayerReference.GetComponent <PlayerHealth>();
        playerAudio     = PlayerReference.GetComponent <PlayerAudio>();

        cameraEffects  = CameraReference.GetComponent <CameraEffects>();
        cameraMovement = CameraReference.GetComponent <CameraMovement>();
    }
Exemplo n.º 23
0
    void Start()
    {
        camEffects = GameManager.Instance.camEffects;

        attackEffect.enabled = false;
        light2D.enabled      = false;
        attackReady          = true;
        attackActive         = false;
        weapon.gameObject.SetActive(false);
    }
Exemplo n.º 24
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Grass")
     {
         Vibrate(0.5f, 0.5f);
         CameraEffects.ShakeOnce(1f, 2f);
         SoundManager.Instance.PlaySe("Collide");
         _boatRB.velocity = new Vector3(0, 0, -10f);
     }
 }
Exemplo n.º 25
0
 virtual protected void TriggerSwitch()
 {
     if (GetComponent <AudioSource>() != null)
     {
         GetComponent <AudioSource>().Play();
     }
     GetComponentInChildren <SpriteRenderer>().sprite = activeSprite;
     CameraEffects.FadeIn();
     player.enabled = false;
 }
Exemplo n.º 26
0
 protected override void Awake()
 {
     base.Awake();
     _transform = transform;
     _input     = GetComponentInParent <PlayerInput>();
     GetComponentInParent <CharacterAnimationInterface>().EndAttackEvent += EndAttackAnim;
     _attacking = false;
     _camera    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraEffects>();
     //_audio = GetComponent<AudioSource>();
 }
Exemplo n.º 27
0
 public void GoToEndScreen()
 {
     CameraEffects.StartFadeToBlack(() =>
     {
         DOTween.KillAll(false);
         Reset();
         StoryState.Instance.Reset();
         UnityEngine.SceneManagement.SceneManager.LoadScene(2);
     });
 }
Exemplo n.º 28
0
    private void Awake()
    {
        Get = this;
        if (transform.localPosition != Vector3.zero || transform.localEulerAngles != Vector3.zero)
        {
            Debug.LogWarning("Camera with CameraEffects should have local position and rotation 0,0,0!! (make it a child to an empty object and change that transform instead)");
        }
        PostProcessVolume postVolume = FindObjectOfType <PostProcessVolume>();

        vignetteLayer = postVolume.profile.GetSetting <Vignette>();
    }
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
Exemplo n.º 30
0
 private void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else if (_instance != this)
     {
         Destroy(this.gameObject);
     }
 }
    // Use this for initialization
    void Start()
    {
        mainCamera = GameObject.FindWithTag("MainCamera");

        cameraWaypoints = new CameraEffects[10];
        for (int i = 0; i < 10; i++)
        {
            cameraWaypoints[i] = new CameraEffects();
            cameraWaypoints[i].wpType = waypointTypes.CAMERA;
            cameraWaypoints[i].camType = i % 2 == 0 ? cameraTypes.SHAKE : cameraTypes.WAIT;
            cameraWaypoints[i].shakeIntensity = i % 4 == 0 ? 2 : 4;
            cameraWaypoints[i].shakeSeconds = i % 4 == 0 ? 2.0f : 4.0f;
            cameraWaypoints[i].waitSeconds = i % 4 == 0 ? 2.0f : 4.0f;
        }

        StartCoroutine(CameraEngine());
    }
Exemplo n.º 32
0
    void Awake()
    {
        effects = GetComponent<CameraEffects>();

        matchSubjectRotation = true;
        lockMovement = false;
        lockFocus = false;
        currentViewAngle = 90;
        distanceFromFocus = TOP_CAMERA_DISTANCE;
    }
Exemplo n.º 33
0
    void Start()
    {
        m_StartingPosition = transform.position;
        m_StartingDirection = new Vector2(-0.7f, -1.0f);//GetRandomStartDirection();
        m_Rigidbody = GetComponent<Rigidbody2D>();
        m_Trail = GetComponent<TrailRenderer>();
        m_TrailTime = m_Trail.time;
        m_PauseCR = null;
        m_CameraEffects = Camera.main.GetComponent<CameraEffects>();
        m_Renderer = GetComponent<SpriteRenderer>();

        GameManager.Instance.Ball = this;
    }
Exemplo n.º 34
0
 void Awake()
 {
     instance = this;
 }
    void Start()
    {
        _menu = GetComponentInChildren<GameMenu>();
        _hud = GetComponentInChildren<GameHud>();

        _camEffects = Camera.main.GetComponent<CameraEffects>();
        _camController = Camera.main.GetComponent<CameraController>();

        _hud.FinalScoreMode(false);
        _hud.gameObject.SetActive(false);
        _menu.Show(OnStartNewGame, null);

        _introState = new IntroState(this) { TimeInState = 5, TimeAwake = 4f };
        _unarmedState = new UnarmedState(this);
        _accState = new AccState(this);
        _powerUpState = new PowerUpState(this);
        _blockadesAndEnemiesState = new BlockadeAndEnemiesState(this);
        _aliensState = new AliensState(this);
        _pauseState = new PauseState(this);
        _aliensFinalState = new AliensFinalState(this);

        _accState.ExitState = _unarmedState;

        Spawner = new Spawner(GamePrefabs);
        Spawner.OnRewardEvent += (reward_pts) =>
        {
            pts += reward_pts;
            _hud.SetPoints(pts);
        };
    }