private void Deactivate() { _bubbleEffect.GetComponent <Animator>().SetBool("bubble_on", false); Invoke("DestroyBubble", 0.25f); ResetState(); DeactivateDelegate.Invoke(); }
IEnumerator End() { yield return(new WaitForSeconds(1)); PounceEffectAnimator.SetBool("thunderpounce_smash", true); Invoke("ResetAnimation", 0.25f); DamageAllBaddies(); ResetCollection(); DeactivateDelegate.Invoke(); }
/// <summary> /// Initializes a new instance of the <see cref="Util.ObjectPool"/> class. /// </summary> /// <param name='prefab'> /// GameObject Prefab to instantiate objects. /// </param> /// <param name='initialSize'> /// Initial size of the pool. /// </param> /// <param name='setActiveRecursively'> /// to call SetActiveRecursively or .active /// </param> /// <param name='onActivate'> /// Delegate to call when object is spawned /// </param> /// <param name='onDeactivate'> /// Delegate to call when object is recycled /// </param> public ObjectPool(GameObject prefab, Transform parent, int initialSize, bool setActiveRecursively, ActivateDelegate onActivate = null, DeactivateDelegate onDeactivate = null) { m_Prefab = prefab; m_SetActiveRecursively = setActiveRecursively; OnActivate = onActivate; OnDeactivate = onDeactivate; m_PoolActive = new List <GameObject>(); m_PoolAvailable = new List <GameObject>(); for (int i = 0; i < initialSize; ++i) { GameObject gameObject = GameObject.Instantiate(m_Prefab) as GameObject; m_PoolAvailable.Add(gameObject); gameObject.transform.SetParent(parent); SetActive(gameObject, false); } }
public PowerUpMeter(int sequenceNumber, Color color) { initialTime = 0f; timer = new Timer(0); float padding = 1f; float height = GameWorld.panelSize; float width = height; float startingPoint = GameWorld.leftEdge + 25f; float offset = startingPoint + (sequenceNumber + 1) * (padding) + sequenceNumber * width + width / 2; box = new XNACS1Rectangle(new Vector2(offset, GameWorld.topEdge + (GameWorld.panelSize / 2)), width, height); box.Texture = "PowerUp_Box1"; initialMeterHeight = height / 1.8f; meter = new XNACS1Rectangle(box.Center, width / 1.8f, initialMeterHeight); meter.Color = color; deactivate = null; }
private void ReturnToOriginAndTurnOff() { CalculateVelocity(_originalPlayerPosition); if (ToIntVector(transform.position) == ToIntVector(_originalPlayerPosition)) { GetComponent <Player>().enabled = true; _cameraScript.enabled = true; if (UpdateNoInteraction) { ResumeBaddieMovement(); } ResetCollections(); DeactivateDelegate.Invoke(); GetComponent <SpriteRenderer>().sortingOrder = 1; SlashEffectAnimator.SetBool("lighteningclaw", false); _activated = false; } }
public void update() { if (timer.isDone()) { meter.Visible = false; if (deactivate != null) { deactivate(); deactivate = null; } } else { timer.update(); meter.Visible = true; meter.Height = initialMeterHeight * Math.Max(0, timer.currentTime() / initialTime); meter.CenterY = box.CenterY - ((initialMeterHeight - meter.Height) / 2); } }
private void LateUpdate() { if (!_active) { return; } if (PlayerHadLanded()) { DamageAllBaddies(); ResetCollection(); DeactivateDelegate.Invoke(); PounceEffectAnimator.SetBool("thunderpounce_smash", false); PounceEffectAnimator.SetBool("thunderpounce_jump", false); _active = false; return; } if (_apexReached && transform.position.y <= (_originPosition.y + 0.5F)) { GetComponent <Player>().enabled = true; } CalculateVelocity(); }
/// <summary> /// Change OnDeactivate method /// </summary> /// <param name='_onDeactivate'> /// delegate method /// </param> public void SetOnDeactivateMethod(DeactivateDelegate _onDeactivate) { OnDeactivate = _onDeactivate; }
public void update() { if (timer.isDone()) { meter.Visible = false; if (deactivate != null) { deactivate(); deactivate = null; } } else { timer.update(); meter.Visible = true; meter.Height = initialMeterHeight * Math.Max(0, timer.currentTime() / initialTime); meter.CenterY = box.CenterY - ((initialMeterHeight - meter.Height) / 2); } }
public void reset(float time, DeactivateDelegate d) { initialTime = time; timer = new Timer(time); deactivate = d; }
public PowerUpMeter(int sequenceNumber, Color color) { initialTime = 0f; timer = new Timer(0); float padding = 1f; float height = GameWorld.panelSize; float width = height; float startingPoint = GameWorld.leftEdge + 25f; float offset = startingPoint + (sequenceNumber + 1) * (padding) + sequenceNumber * width + width / 2; box = new XNACS1Rectangle(new Vector2(offset, GameWorld.topEdge + (GameWorld.panelSize / 2)), width, height); box.Texture = "PowerUp_Box1"; initialMeterHeight = height / 1.8f; meter = new XNACS1Rectangle(box.Center, width / 1.8f, initialMeterHeight); meter.Color = color; deactivate = null; }
private void DeactivateUltimate() { GetComponent <Player>().enabled = true; _cameraScript.enabled = true; DeactivateDelegate.Invoke(); }
public void reset(float time, DeactivateDelegate d) { initialTime = time; timer = new Timer(time); deactivate = d; }