Beispiel #1
0
 private void TryAngleSingle(OnHitDetectData data)
 {
     if (Vector2.Angle(data.BulletShootDirection, VectorExtensions.DegreeToVector2(rotation - 90)) <= 55)
     {
         ShootAtDirection(rotation + 90, data);
     }
 }
Beispiel #2
0
        private void ShootAtDirection(float rotationToShoot, OnHitDetectData data)
        {
            var range = -1f;

            if (data.BulletObject.TryGetComponent <ProjectileRangeLimited>(out var rangeLimited))
            {
                range = rangeLimited.CurrentDistance;
            }

            CastProjectileMessage.SendToAll(gameObject, data.BulletObject.GetComponent <Bullet>().PrefabName, VectorExtensions.DegreeToVector2(rotationToShoot), default, range);