Exemplo n.º 1
0
    private void Awake()
    {
        Instance = this;

        for (int i = 0; i < startSpawn; i++)
        {
            Get();
        }
    }
Exemplo n.º 2
0
    protected virtual IHealth Spawn(Vector3 pos)
    {
        var obj = GenericObjectPooler.RequestObject(objectToSpawn, false);

        obj.transform.localScale = targetScale;
        obj.transform.position   = pos;
        obj.gameObject.SetActive(true);
        IHealth health = obj.gameObject.GetComponent <IHealth>();

        health.FillToMaxHealth();
        Debug.DrawLine(pos, pos + Vector3.up * 10, Color.red, 1f);
        return(health);
    }
Exemplo n.º 3
0
    public override void CreateTrail(ShootInfo shootInfo)
    {
        Vector3 start = weaponFirepos.GetWeaponFirePos();
        Vector3 end   = shootInfo.end;

        start = NagaUtils.GetPointAlongDirection(start, end - start, Random.value * startposRandomness);

        TrailRenderer trail = GenericObjectPooler.RequestObject(trailRenderer).gameObject.GetComponent <TrailRenderer>();

        trail.gameObject.transform.position = start;
        trail.gameObject.SetActive(true);

        trail.Clear();

        Timing.RunCoroutine(_TweenTrail(trail, end));
    }
Exemplo n.º 4
0
 public void CreatePool(int amountToPool)
 {
     GenericObjectPooler.CreatePool(objectToSpawn, amountToPool);
 }
Exemplo n.º 5
0
 void Awake()
 {
     current = this;
 }
 void Awake() //So we may not even want to use a singleton here? Singleton means only one pooler.
 //But one of the reasons to use this script is to let a bunch of enemies all use it for one bullet type, and then another instance of this class for another object type
 {
     instance = this;
 }
Exemplo n.º 7
0
 public override void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode)
 {
     base.OnLevelFinishedLoading(scene, mode);
     objPool = new GenericObjectPooler <Projectile>(prefab, size);
 }
Exemplo n.º 8
0
 private void Start()
 {
     objPool = new GenericObjectPooler <Projectile>(prefab, size);
 }
Exemplo n.º 9
0
 //Since this can be reused very easily and just generally be used for any kind of trail, might refactor this
 //into a parent/base class
 private void Start()
 {
     GenericObjectPooler.CreatePool(trailRenderer, trailsToPool);
 }