Exemple #1
0
        /// <summary>
        ///     Tries to find a solution that allows us to shoot a projectile that hits the target
        /// </summary>
        /// <param name="turret"></param>
        /// <param name="projectile"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static FiringSolution?FindSolution(GameObject turret,
                                                  ProjectileComponent projectile,
                                                  GameObject target)
        {
            var rocket = target.GetComponent <RocketComponent>();
            var body   = target.GetComponent <Rigidbody>();

            var targetPosition     = target.transform.position;
            var targetVelocity     = body.velocity;
            var targetAcceleration = rocket.CurrentAcceleration;

            var position = turret.transform.position;
            var velocity = projectile.Velocity;
            var range    = projectile.Range;

            return(TrySolve(position, velocity, range, targetPosition, targetVelocity, targetAcceleration));
        }
Exemple #2
0
 public void TakeDamage(ProjectileComponent other)
 {
     Explode();
 }