예제 #1
0
 private void FixedUpdate()
 {
     if (spawnGroupsSinceLastDeadTime < spawnGroupsPerDeadTime)
     {
         if (spawnGroupActive)
         {
             while (timerSpawn.TimeUp(ts.DeltaTime()))
             {
                 ChooseRandomSpawnPosition();
                 SpawnEnemy();
             }
         }
         else
         {
             while (timerSpawnGroup.TimeUp(ts.DeltaTime()))
             {
                 challengeCurrent = 0.0f;
                 challengeMax    += challengeIncreasePerSpawnGroup;
                 spawnGroupActive = true;
                 //ChooseRandomSpawnPosition();
                 spawnGroupsSinceLastDeadTime += 1;
             }
         }
     }
     else
     {
         while (timerDeadTime.TimeUp(ts.DeltaTime()))
         {
             spawnGroupsSinceLastDeadTime = 0;
         }
     }
 }
예제 #2
0
    private void FixedUpdate()
    {
        float   xDifference = oscX.SampleDelta(timeScale.DeltaTime());
        float   yDifference = oscY.SampleDelta(timeScale.DeltaTime());
        Vector2 change      = new Vector2(xDifference, yDifference);

        mover.OffsetPosition(change);
    }
예제 #3
0
 private void FixedUpdate()
 {
     secondsPassed += ts.DeltaTime();
     while (timerPointsPerSecond.TimeUp(ts.DeltaTime()))
     {
         textScore.AddValue(pointsPerSecondPlaying);
     }
 }
예제 #4
0
 private void FixedUpdate()
 {
     while (timerBattleAxe.TimeUp(ts.DeltaTime()))
     {
         playerPunch.UseBattleAxe(false);
         SetPowerupExists(false);
     }
     while (timerMoreArms.TimeUp(ts.DeltaTime()))
     {
         playerPunch.UseMoreArms(false);
         SetPowerupExists(false);
     }
 }
예제 #5
0
 private void FixedUpdate()
 {
     meterPunchCooldown.SetPercent(timerPunchCooldown.GetPercentFinished());
     while (timerPunching.TimeUp(ts.DeltaTime()))
     {
         // Punch finished.
         punchingObject.SetActive(false);
         timerPunchCooldown.Start();
     }
     while (timerPunchCooldown.TimeUp(ts.DeltaTime()))
     {
         // Punch cooldown finished.
     }
 }
예제 #6
0
    private void FixedUpdate()
    {
        float dt = ts.DeltaTime();

        while (timerHesitate.TimeUp(dt))
        {
            timerFinished = true;
        }
        if (timerFinished)
        {
            // Shrink the buffer.
            float stepSize = dt * shrinkSpeed;
            if (shrinkToLeft)
            {
                bufferUpper = UtilMath.Approach(bufferUpper, bufferLower, stepSize);
            }
            else
            {
                bufferLower = UtilMath.Approach(bufferLower, bufferUpper, stepSize);
            }
            UpdateBufferMeter();

            if (bufferLower == bufferUpper)
            {
                timerFinished = false;
            }
        }
    }
예제 #7
0
    private void FixedUpdate()
    {
        Vector2 velocity = vius.GetVelocity();

        velocity.y -= acceleration * gravityScale * timeScale.DeltaTime();
        vius.SetVelocity(velocity);
    }
예제 #8
0
    private void FixedUpdate()
    {
        float dt = timeScale.DeltaTime();

        if (velocity != Vector2.zero)
        {
            mover.TeleportPosition(
                UtilApproach.Vector2D(mover.GetPosition(), target, velocity * dt));
            if (mover.GetPosition() == target)
            {
                // The object has reached its destination.
                // Do different things depending on the current state.
                if (state == State.Rise)
                {
                    state = State.Idle;
                    timerIdle.Run();
                }
                else if (state == State.Lower)
                {
                    Destroy(gameObject);
                }
            }
        }

        timerWarning.Tick(dt);
        timerIdle.Tick(dt);
    }
예제 #9
0
    private void FixedUpdate()
    {
        Vector2 velocity = rb.velocity;

        velocity += upDirection.GetDownVector() * acceleration * gravityScale
                    * timeScale.DeltaTime();
        rb.velocity = velocity;
    }
예제 #10
0
    private void FixedUpdate()
    {
        float dt = timeScale.DeltaTime();

        foreach (AttackGroup attackGroup in data.attackGroups)
        {
            attackGroup.Tick(dt);
        }
    }
예제 #11
0
 private void FixedUpdate()
 {
     if (spawnGroupsSinceLastDeadTime < spawnGroupsPerDeadTime)
     {
         if (spawnGroupActive)
         {
             timerSpawn.Tick(timeScale.DeltaTime());
         }
         else
         {
             timerSpawnGroup.Tick(timeScale.DeltaTime());
         }
     }
     else
     {
         timerDeadTime.Tick(timeScale.DeltaTime());
     }
 }
예제 #12
0
    private void FixedUpdate()
    {
        Vector3 euler = transform.eulerAngles;

        euler.z = Angle.FromDegrees(euler.z).ApproachCoterminal(
            upDirection.GetUpAngle().AddDegrees(-90.0f),
            rotationSpeed * timeScale.DeltaTime())
                  .GetDegrees();
        transform.rotation = Quaternion.Euler(euler);
    }
    private void UpdateCurrentDegreesHeading()
    {
        mover.TeleportRotation(mover.GetRotation().Approach(
                                   angleTarget, angleChangePerSecond * timeScale.DeltaTime()));

        /*
         *  UtilApproach.AngleDegrees(mover.GetRotation(),
         *  targetDegrees, degreeChangePerSecond * timeScale.DeltaTime()));
         */
    }
예제 #14
0
    private void FixedUpdate()
    {
        timerHesitate.Tick(timeScale.DeltaTime());
        if (timerFinished)
        {
            // Shrink the buffer.
            float stepSize = timeScale.DeltaTime() * shrinkSpeed;
            if (shrinkToLeft)
            {
                bufferUpper = UtilMath.Approach(bufferUpper, bufferLower, stepSize);
            }
            else
            {
                bufferLower = UtilMath.Approach(bufferLower, bufferUpper, stepSize);
            }
            UpdateBufferMeter();

            if (bufferLower == bufferUpper)
            {
                timerFinished = false;
            }
        }
    }
예제 #15
0
    private void FixedUpdate()
    {
        Vector3 euler = transform.eulerAngles;

        euler.z = Angle.FromDegrees(euler.z).Approach(
            upDirection.GetUpAngle().AddDegrees(-90.0f),
            Angle.FromDegrees(rotationSpeed * timeScale.DeltaTime()))
                  .GetDegrees();
        //UtilPeriodic.Approach()

        /*
         *  UtilApproach.AngleDegrees(euler.z,
         *  upDirection.GetUpAngle() - 90.0f, rotationSpeed * timeScale.DeltaTime());
         */
        transform.rotation = Quaternion.Euler(euler);
    }
예제 #16
0
 private void FixedUpdate()
 {
     if (lerping)
     {
         Vector2 stepVelocity = velocity * timeScale.DeltaTime();
         if (stepVelocity.sqrMagnitude >
             (destination - mover.GetPosition()).sqrMagnitude)
         {
             mover.TeleportPosition(destination);
             OnCompleted();
         }
         else
         {
             mover.OffsetPosition(stepVelocity);
         }
     }
 }
예제 #17
0
    public void ReceiveInput(InputReader inputReader)
    {
        float   axisH  = inputReader.GetAxisHorizontalRaw();
        float   axisV  = inputReader.GetAxisVerticalRaw();
        Vector2 change = new Vector2(axisH, axisV)
                         * data.movementSpeed * tsGameplay.DeltaTime();

        mover.OffsetPosition(change);

        if (!tsGameplay.IsPaused())
        {
            if (inputReader.GetKeyDown(KeyCode.Space))
            {
                playerPunch.Punch();
            }
        }

        if (inputReader.GetKeyDown(KeyCode.Escape))
        {
            TogglePause();
        }
    }
예제 #18
0
    private void FixedUpdate()
    {
        Vector2 velocity = vius.GetVelocity();
        float   dt       = timeScale.DeltaTime();

        // Decelerate if the Rigidbody is grounded and not accelerating.
        if (groundChecker.IsOnGround() && accumulatedHorizontalAcceleration == 0.0f)
        {
            velocity.x = UtilApproach.Float(velocity.x, 0.0f, groundDeceleration * dt);
        }

        // Accelerate the Rigidbody based on applied forces.
        velocity.x += accumulatedHorizontalAcceleration * dt;
        accumulatedHorizontalAcceleration = 0.0f;

        // Cap the Rigidbody's velocity.
        if (Mathf.Abs(velocity.x) > maxHorizontalSpeed)
        {
            velocity.x = Mathf.Sign(velocity.x) * maxHorizontalSpeed;
        }

        vius.SetVelocity(velocity);
    }
예제 #19
0
 private void FixedUpdate()
 {
     timerItemText.Tick(timeScale.DeltaTime());
 }
예제 #20
0
 private void FixedUpdate()
 {
     secondsPassed += ts.DeltaTime();
     timerPointsPerSecond.Tick(ts.DeltaTime());
 }
예제 #21
0
 private void FixedUpdate()
 {
     // Update the GameObject's angle.
     mover.TeleportRotation(mover.GetRotation().ApproachCoterminal(
                                angleTarget, angleChangePerSecond * timeScale.DeltaTime()));
 }
예제 #22
0
    private void FixedUpdate()
    {
        Vector3 euler = transform.eulerAngles;

        euler.z = UtilMath.ApproachAngleDegrees(euler.z,
                                                upDirection.GetUpAngle() - 90.0f, rotationSpeed * timeScale.DeltaTime());
        transform.rotation = Quaternion.Euler(euler);
    }
예제 #23
0
 private void FixedUpdate()
 {
     timerVolley.Tick(timeScale.DeltaTime());
 }
예제 #24
0
    private void FixedUpdate()
    {
        float difference = osc.SampleDelta(timeScale.DeltaTime());

        accessor.Set(accessor.Get() + difference);
    }
예제 #25
0
    private void FixedUpdate()
    {
        float difference = osc.SampleDelta(timeScale.DeltaTime());

        timeRegion.SetFactor(timeRegion.GetFactor() + difference);
    }
예제 #26
0
 private void FixedUpdate()
 {
     timerTongue.Tick(timeScale.DeltaTime());
 }
예제 #27
0
 private void FixedUpdate()
 {
     timerBattleAxe.Tick(ts.DeltaTime());
     timerMoreArms.Tick(ts.DeltaTime());
 }
예제 #28
0
 private void FixedUpdate()
 {
     timerRestart.Tick(timeScale.DeltaTime());
 }
예제 #29
0
 private void FixedUpdate()
 {
     timerColor.Tick(timeScale.DeltaTime());
 }
예제 #30
0
 private void FixedUpdate()
 {
     mover.OffsetPosition(velocity * timeScale.DeltaTime());
 }