Beispiel #1
0
    private void SpawnEnemy(string id, Vector2 position)
    {
        var bulletObj = ObjectPool.GetObject("Spawn", "SkillBullets");
        var bullet    = bulletObj.GetComponent <Spawn>();

        bullet.Target         = player;
        bullet.gameObjectName = id;
        bullet.point          = position;
        bullet.Launch(position, Vector2.zero);
    }
Beispiel #2
0
 private void Spawns()
 {
     foreach (var point in points)
     {
         var bulletObj = ObjectPool.GetObject("Spawn", "SkillBullets");
         var bullet    = bulletObj.GetComponent <Spawn>();
         bullet.Target         = Target;
         bullet.gameObjectName = gameObjectName;
         bullet.point          = point;
         bullet.Launch(point, Vector2.zero);
     }
     ObjectPool.RecycleObject(this.gameObject);
 }
Beispiel #3
0
    private IEnumerator SpawnCoroutine()
    {
        yield return(spawning);

        var enemy = ObjectPool.GetObject(gameObjectName, "Entities");

        enemy.transform.position = point;

        Behavior behavior = enemy.GetComponent <Behavior>();

        if (behavior != null)
        {
            behavior.SetVariableValue("TrackTarget", Target);
            behavior.EnableBehavior();
            behavior.Start();
        }
        ObjectPool.RecycleObject(this.gameObject);
    }