Beispiel #1
0
        /// <summary>
        /// Updates the aim prediction with the current aim information. Usually this method should be called on Update but you
        /// can call this less often if you want a more jittery display.
        /// </summary>
        /// <param name="aimVector">The normalized vector of the current aim.</param>
        /// <param name="strengthPercent">The strength percentage between 0.0 and 1.0.</param>
        /// <exception cref="Exception"></exception>
        public void UpdateDisplay(Vector2 aimVector, float strengthPercent)
        {
            if (!_isInit)
            {
                throw new Exception("Trying to update the aim prediction before initializing the component! Try calling Init() first.");
            }

            transform.rotation = Quaternion.Euler(0f, 0f, VectorUtils.AngleBetweenVector2(Vector2.zero, aimVector));
            PredictTrajectory(aimVector * (_shooterMaxVelocity * strengthPercent));
        }