Example #1
0
    public void TryExit()
    {
        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;
        Time.timeScale = 0f;

        uiPos = UIPos.Exit;
    }
Example #2
0
    public void PauseGame()
    {
        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;
        Time.timeScale = 0f;

        uiPos = UIPos.Pause;
    }
Example #3
0
    public void ResumeGame()
    {
        PostProcessingEffect.depthOfField.focusDistance.value = 0.5f;
        Time.timeScale = 1f;

        uiPos = UIPos.Play;
    }
Example #4
0
    public void SetUI()
    {
        if (uiPos != lastUiPos)
        {
            UI[lastUiPos].SetActive(false);
            UI[uiPos].SetActive(true);

            lastUiPos = uiPos;
        }
    }
Example #5
0
    //移动UI,改变尺寸
    void Move(UIPos from, UIPos to, UXMovement movement_Size, UXMovement movement_Pos, Action onComplete = null)
    {
        target.sizeDelta = from.size;
        target.position  = from.pos;

        target.DOSizeDelta(to.size, movement_Size.duration).SetEase(movement_Size.curve);
        target.DOMove(to.pos, movement_Pos.duration).SetEase(movement_Pos.curve).OnComplete(() => {
            onComplete?.Invoke();
        });
    }
Example #6
0
    public void CloseCamera()
    {
        uiPos = UIPos.Play;

        Time.timeScale = 1;

        PostProcessingEffect.vignette.center.value    = new Vector2(0.2f, 0f);
        PostProcessingEffect.vignette.intensity.value = 0.05f;

        PostProcessingEffect.depthOfField.focusDistance.value = 0.5f;
    }
Example #7
0
    public void OpenPic(Texture2D tx)
    {
        uiPos = UIPos.Camera;

        Time.timeScale = 0;

        PostProcessingEffect.vignette.center.value    = new Vector2(0.5f, 0.5f);
        PostProcessingEffect.vignette.intensity.value = 0.255f;

        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;

        PictureShow.sprite = Sprite.Create(tx, new Rect(0, 0, tx.width, tx.height), new Vector2(0.5f, 0.5f));
    }
Example #8
0
    public void Home()
    {
        reset();

        isStart = false;

        StartCoroutine(SoundFadeOut(GameMusic, 0.5f));

        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;
        BaseWaterBuoyancy.flowMagnitude = 0;

        uiPos = UIPos.Menu;
    }
Example #9
0
    private void Awake()
    {
        audioManager          = GetComponent <AudioManager>();
        Noise                 = vCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
        Noise.m_AmplitudeGain = 0;
        Noise.m_FrequencyGain = 0;

        StartCoroutine(SoundFadeIn(BaseSFX, 0.5f));

        //set default
        isDeath        = false;
        Time.timeScale = 1;

        //if there's no saved file, make new
        if (PlayerPrefs.GetInt("Char Index", -1) == -1)
        {
            Tutorial.gameObject.SetActive(true);
            firstTimePlay = true;
            SavedData.SaveData(true);

            Debug.Log("Making New Saving Data...");
        }

        //get data from the saved file
        SavedData.GetData();

        //reset the virtual camera
        vCamera.Follow = null;
        vCamera.LookAt = null;

        //setting up the post processing
        PostProcessingEffect.Setup();
        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;
        PostProcessingEffect.vignette.center.value            = new Vector2(0.2f, 0f);
        PostProcessingEffect.vignette.intensity.value         = 0.05f;

        //setting up the UI
        AddUI();
        uiPos     = UIPos.Menu;
        lastUiPos = uiPos;

        //setup the water bouyancy physics
        startWaterFlowMagnitude         = BaseWaterBuoyancy.flowMagnitude;
        BaseWaterBuoyancy.flowMagnitude = 0;

        //setting up the player
        player           = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
        spawnPoint       = player.transform.position;
        player.character = data.Character[SavedData.CharIndex];
        player.boat      = data.Boats[SavedData.BoatIndex];
    }
Example #10
0
    public void StartGame()
    {
        isStart = true;

        StartCoroutine(SoundFadeIn(GameMusic, 0.5f));

        vCamera.Follow = player.transform;
        vCamera.LookAt = player.transform;

        PostProcessingEffect.depthOfField.focusDistance.value = 0.5f;
        BaseWaterBuoyancy.flowMagnitude = startWaterFlowMagnitude;

        uiPos = UIPos.Play;
    }
Example #11
0
    //移动UI,改变缩放而非尺寸
    public void MoveWithScale(UIPos from, UIPos to, UXMovement movement_Size, UXMovement movement_Pos, Action onComplete = null)
    {
        Vector2 fromSize = from.size / target.sizeDelta;

        target.localScale = fromSize;
        target.position   = from.pos;

        Vector2 toSize = to.size / target.sizeDelta;

        target.DOScale(toSize, movement_Size.duration).SetEase(movement_Size.curve);
        target.DOMove(to.pos, movement_Pos.duration).SetEase(movement_Pos.curve).OnComplete(() => {
            onComplete?.Invoke();
        });
    }
Example #12
0
    public void RestartGame()
    {
        reset();

        PostProcessingEffect.depthOfField.focusDistance.value = 0.5f;

        foreach (GameObject g in GameObject.FindGameObjectsWithTag("BG"))
        {
            Destroy(g);
        }

        foreach (Background bg in BGParent.GetComponentsInChildren <Background>())
        {
            bg.isPlaced = false;
        }

        uiPos = UIPos.Play;
    }
Example #13
0
    public void Death()
    {
        PostProcessingEffect.depthOfField.focusDistance.value = 0.1f;
        Time.timeScale = 0.5f;

        int score = maxDistance + (50 * maxSpeed) + (200 * PhotoCaptured);

        maxDistanceText.text   = maxDistance + " m";
        maxSpeedText.text      = string.Format("50 x {0} m/s", maxSpeed);
        photoCapturedText.text = string.Format("200 x {0}", PhotoCaptured.ToString());
        scoreText.text         = score.ToString();

        yourBest.text = score >= SavedData.bestScore ? "Best Score!" : string.Format("Your Best: {0}", SavedData.bestScore);

        uiPos = UIPos.Death;

        SavedData.SetBestSpeed(maxSpeed);
        SavedData.SetBestDistance(maxDistance);
        SavedData.SetBestScore(score);
        SavedData.SaveData();
    }
Example #14
0
 public void GoBackToMenu()
 {
     uiPos = UIPos.Menu;
 }
Example #15
0
 public void GoToBoatSelect()
 {
     uiPos = UIPos.Boat;
 }
Example #16
0
 public void GoToCharacterSelect()
 {
     uiPos = UIPos.Character;
 }