Exemplo n.º 1
0
    internal void Tick()
    {
        mUnitComponent.Acceleration = Vector2.ClampMagnitude(mUnitComponent.Acceleration, mUnitComponent.MaxAcceleration);

        mUnitComponent.Velocity += (mUnitComponent.Acceleration * Time.deltaTime);
        mUnitComponent.Velocity  = Vector2.ClampMagnitude(mUnitComponent.Velocity, mUnitComponent.MaxVelocity);

        if (mUnitComponent.Velocity.sqrMagnitude > kEpsilon)
        {
            mUnitComponent.Position += mUnitComponent.Velocity * Time.deltaTime;
            transform.position       = VectorHelpers.Vector2ToVector3(mUnitComponent.Position, transform.position.y);
        }
    }