Exemple #1
0
 public static IProjectile[] Get(this IProjectilePool projPool, Vector3 position, Quaternion rotation, float deviation, int amount)
 {
     IProjectile[] result = new IProjectile[amount];
     for (int i = 0; i < amount; i++)
     {
         result[i] = projPool.Get(position, rotation, deviation);
     }
     return(result);
 }
Exemple #2
0
        public static IProjectile Get(this IProjectilePool projPool, Vector3 position, Quaternion rotation, float deviation)
        {
            float       d         = UnityEngine.Random.Range(-deviation, deviation);
            Vector3     direction = rotation * new Vector3(1f, Mathf.Sin(Mathf.Deg2Rad * d), 0f);
            IProjectile proj      = projPool.Get(position, rotation);

            (proj as Component).transform.right = direction;
            return(proj);
        }
Exemple #3
0
 public HitInfo(DamageInfo damage, Collider2D collider, Vector3 point, Vector3 normal, IProjectile projectile, IProjectilePool weapon, bool final)
 {
     DamageInfo = damage;
     Collider   = collider;
     Point      = point;
     Normal     = normal;
     Projectile = projectile;
     Weapon     = weapon;
     Final      = final;
 }
        private void Awake()
        {
            _muzzles       = GetMuzzles();
            _fireParticles = GetFireParticles(_muzzles);

            _fireAnimation = GetComponent <IFireAnimation>() ?? new NoFireAnimation();
            _fireControl   = GetComponent <IFireSequence>() ?? new InstantFireSequence();
            _fireSync      = GetComponent <IFireControl>() ?? new NoFireControl();

            _pool           = new NoGameObjectPool <IProjectile>(ProjectilePrefab);
            _projectilePool = new ProjectilePool(_pool);
            _pool.OnNew    += OnNewProjectile;


            if (isActiveAndEnabled)
            {
                _chambered = false;
                StartCoroutine(Rechamber(Cooldown));
            }
        }
Exemple #5
0
 public void Link(IProjectilePool weapon)
 {
 }