示例#1
0
    private void Update()
    {
        if (Rotater.gameObject.activeSelf)
        {
            delta = Velocity * Time.deltaTime;
            mediator.DistanceTraveled += delta;
            mediator.TimeElapsed      += Time.deltaTime;
            SystemRotation            += delta * DeltaToRotation;

            mediator.UpdateDistance(mediator.DistanceTraveled);
            mediator.UpdateTime(mediator.TimeElapsed);

            if (SystemRotation >= CurrentPipe.CurveAngle)
            {
                delta                = (SystemRotation - CurrentPipe.CurveAngle) / DeltaToRotation;
                CurrentPipe          = PipeSystem_.SetupNextPipe();
                mediator.CurrentPipe = CurrentPipe;
                DeltaToRotation      = 360f / (2f * Mathf.PI * CurrentPipe.CurveRadius);
                SetupCurrentPipe();
                SystemRotation = delta * DeltaToRotation;
            }

            mediator.UpdatePlayerRotation();


            if (Input.GetKeyDown(KeyCode.Space))
            {
                mediator.Fire();
            }

            PipeSystem_.transform.localRotation = Quaternion.Euler(0f, 0f, SystemRotation);
        }
    }
示例#2
0
    public void StartGame()
    {
        Health           = 3;
        Score            = 0;
        DistanceTraveled = 0f;
        TimeElapsed      = 0f;

        mediator.UpdateHealth(Health);
        mediator.UpdateScore(Score);
        mediator.UpdateDistance(DistanceTraveled);
        mediator.UpdateTime(TimeElapsed);

        PlayerRotation = 0f;

        mediator.SystemRotation = 0f;
        mediator.WorldRotation  = 0f;
        mediator.CurrentPipe    = mediator.SetupFirstPipe();
        mediator.SetupCurrentPipe();
        mediator.ShowBeam(false);

        SecondaryCamera.SetActive(false);
        Rotater.gameObject.SetActive(true);
    }