Beispiel #1
0
 public Shooter(Transform projectilePrefab, Transform shooterTransform, IPositionSpawner spawner, int rateOfFire)
 {
     this.shooterTransform = shooterTransform;
     this.spawner          = spawner;
     pool         = new Pool <Transform>(new ComponentCreator <Transform>(projectilePrefab), 30);
     lastShot     = Time.time;
     fireInterval = 60.0f / rateOfFire;
 }
Beispiel #2
0
    private Asteroid(IPositionSpawner spawner, int health, Vector3 position)
    {
        this.spawner = spawner;
        this.health  = health;
        NativeArray <Vector2> polygons =
            RandomUtils.RandomConvexPolygon(Random.Range(MinVertices, MaxVertices), health / HealthSizeProportion);

        gameObject = ObjectUtils.CreatePolygonalObject("Asteroid", Layers.Asteroid, polygons, 0.1f);
        gameObject.transform.position = position;
        AddComponents();
        polygons.Dispose();
    }
Beispiel #3
0
 private static void CreateAsteroid(IPositionSpawner spawner, int health, Vector3 position)
 {
     Asteroid _ = new Asteroid(spawner, health, position);
 }
Beispiel #4
0
 public static void CreateAsteroid(IPositionSpawner spawner)
 {
     CreateAsteroid(spawner, InitialHealth, spawner.Position());
 }
 public AsteroidReallocator(Transform asteroid, IPositionSpawner spawner)
 {
     this.asteroid = asteroid;
     this.spawner  = spawner;
     turn          = Random.Range(0, FrameInterval);
 }
Beispiel #6
0
 public PoolReturner(Pool <Transform> pool, Transform obj, IPositionSpawner spawner)
 {
     this.pool    = pool;
     this.obj     = obj;
     this.spawner = spawner;
 }