protected void Start() { if (DistanceBetweenPoints <= 0) { DistanceBetweenPoints = 0.3f; } //OnPathCalculation(); NormalizedTLeaps = (1f / 250f); PathDiscoveryPointPool = GameObjectPool.Instance.GetPathDiscoveryPool(PathDiscoveryPointPrefab); PathDiscoveryPoint[] pds = new PathDiscoveryPoint[500]; int counter = 0; for (float i = 0; i < 1.0f; i += NormalizedTLeaps) { PathDiscoveryPoint pd = PathDiscoveryPointPool.Get(); pd.transform.position = spline.GetPoint(i); pd.Proximity = i; //pd.gameObject.SetActive(true); pds[counter] = pd; pd = null; counter += 1; } pathphobject = GameObjectPool.Instance.PlaceHoldersDict["_PlaceHolder_" + PathDiscoveryPointPrefab.name]; StartCoroutine(movePathObjectsAndTriggerDetection(pds)); }
public override void InitializeAttack(GenericWeaponController parentWeapon) { if (!Projectiles.IsNullOrEmpty()) { projectilePool = Projectiles[0].CreatePool(); } else { Debug.LogWarning("Empty Projectile"); } }
public PoolObjectQueue <GenericProjectile> CreatePool(string ParentName) { GenericProjectile proj = GameObject.Instantiate(ProjectileBase, nowhere, Quaternion.identity); proj.BaseProjectileEffect = projectileEffect; proj.MovementFunction = projectileMovement; proj.gameObject.SetActive(true); proj.OnHitAnimation = OnHitAnimation; proj.name = ParentName + "_" + ProjectileBase.name + "_" + Random.Range(0, 999999); GameObject placeholder = GameObject.Instantiate(new GameObject(), Vector3.zero, Quaternion.identity, GameObjectPool.Instance.transform); placeholder.name = proj.name + "_placeHolder"; proj.gameObject.SetActive(false); PoolObjectQueue <GenericProjectile> pool = new PoolObjectQueue <GenericProjectile>(proj, 10, placeholder); //pool.ObjectQueue.Enqueue(proj); projectilePool = pool; return(pool); }
public override void InitializeAttack(GenericWeaponController parentWeapon) { projectilePool = Projectiles[0].CreatePool(); }