public void Deactivate() { if (this.State == WellSwitchState.Inactive) { return; } SetState(WellSwitchState.Inactive); effect.Dissipate(); effect = null; }
public void Dissipate() { OnDissipate(); if (effect != null) { effect.Dissipate(); } Destroy(); }
protected override void OnUpdate() { if (hero == null) { return; } if (hero.IsSpellEnoughMana && !hero.IsSpellOnCooldown) { spellButton.Color = new Color(1, 1, 1); cooldownText.text = ""; if (spellButtonGlow == null) { spellButtonGlow = Game.Objects.CreatePrefab <SimpleEffect>(spellButtonEffect); spellButton.AddChild(spellButtonGlow); } } else { if (!hero.IsSpellEnoughMana) { spellButton.Color = new Color(.75f, .75f, 1, 1f); } else { spellButton.Color = new Color(.75f, .75f, .75f, 1f); } if (hero.IsSpellOnCooldown) { cooldownText.text = string.Format("{0:0}", hero.SpellCooldown); } else { cooldownText.text = ""; } if (spellButtonGlow != null) { spellButtonGlow.Dissipate(); spellButtonGlow = null; } } if (Input.GetKeyDown(KeyCode.P)) { Game.Entities.GetPlayer(hero.Side).Score++; } var curPoint = Game.Input.CurrentTouchPoint; if (Game.Input.IsTouchBegin && curPoint.HasValue) { if (spellButton.Bounds.Contains(curPoint.Value)) { hero.CastSpell(); } else if (touchRegion.OverlapPoint(curPoint.Value)) { this.HandleTouchBegin(curPoint.Value); } } else if (Game.Input.IsTouchRelease) { this.HandleTouchRelease(Game.Input.PreviousTouchPoint.Value); } else if (beingTouched) { this.HandleTouch(curPoint.Value); } else { inputState = PlayerControllerInputState.None; } var w = hero.Waypoint; if (w.HasValue) { if (w.Value != this.waypoint.Position) { this.waypoint.MoveTo(w.Value); } } else { this.waypoint.Hide(); } }