private void SetData_EnemyShipFiring(PoolableEnemy spawnedObject) { EnemyShipFiring theComponent = spawnedObject.enemyShipFiring; theComponent.minFireFrames = minFireFrames; theComponent.maxFireFrames = maxFireFrames; }
private void Spawn() { _nextSpwanTime = Time.time + _delay; Transform spwanPoint = GetSpawnPoint(); //Enemy enemy = GetEnemy(); PoolableEnemy poolableEnemyPrefab = GetPoolableEnemy(); var pe = poolableEnemyPrefab.Get <PoolableEnemy>(spwanPoint.position, spwanPoint.rotation); //var e = GetEnemy(enemy, spwanPoint); //e.transform.position = spwanPoint.position; //e.transform.rotation = spwanPoint.rotation; //Instantiate(enemy, spwanPoint.position, spwanPoint.rotation); }
private void SetData_EnemyShipMovement(PoolableEnemy spawnedObject) { EnemyShipMovement theComponent = spawnedObject.enemyShipMovement; theComponent.SetStartLocation(spawnedObject.Position); theComponent.moveDistance = moveDistance; theComponent.maxMoveSteps = maxMoveSteps; theComponent.useRandomSeed = useRandomSeed; theComponent.seed = seed; theComponent.BuildRandomFromSeed(); }
private void SetData_ProjectileShooter(PoolableEnemy spawnedObject) { ProjectileShooter theComponent = spawnedObject.projectileShooter; theComponent.projectilePrefab = projectilePrefab; theComponent.fireStartVariance = fireStartVariance; theComponent.targetVariance = targetVariance; theComponent.autoFireDelay = autoFireDelay; int index = Mathf.Min(theComponent.barrels.Count, barrelOffsets.Count); for (int i = 0; i < index; i++) { theComponent.barrels[i].transform.localPosition = barrelOffsets[i]; } }
}//Start public void AddDeadBody(PoolableEnemy toAdd) { if (this.bodies.Contains(toAdd)) { return; } this.bodies.Add(toAdd); if (this.bodies.Count >= DeadBodiesLimit) { this.Return(this.bodies[0]); this.bodies.RemoveAt(0); } this.EOnDeadBodyAdded?.Invoke(toAdd, this); }//AddDeadBody
public override void Spawn() { PoolableObject theObj = GameManager.Pooling.UnpoolObject(theID); PoolableEnemy objAsEnemy = theObj.GetComponent <PoolableEnemy> () as PoolableEnemy; //TODO: Why doesn't this line work??? //objAsEnemy = theObj as PoolableEnemy; if (objAsEnemy.killableObject != null) { objAsEnemy.killableObject.RequestRevive(); } objAsEnemy.transform.position = transform.position; SetData_EnemyShipMovement(objAsEnemy); SetData_EnemyShipFiring(objAsEnemy); SetData_ProjectileShooter(objAsEnemy); }