Esempio n. 1
0
    public void Activate()
    {
        if (this.State != WellSwitchState.Inactive)
        {
            return;
        }

        SetState(WellSwitchState.Neutral);
        effect = Game.Objects.CreatePrefab <SimpleEffect>(activeEffect);
        this.AddChild(effect);
    }
Esempio n. 2
0
    public void Deactivate()
    {
        if (this.State == WellSwitchState.Inactive)
        {
            return;
        }

        SetState(WellSwitchState.Inactive);
        effect.Dissipate();
        effect = null;
    }
Esempio n. 3
0
    public void Initialize(TEntity entity, IInteralBuffable manager)
    {
        this.entity  = entity;
        this.manager = manager;

        if (visualEffect != null)
        {
            effect = Game.Objects.CreatePrefab <SimpleEffect>(visualEffect);
            entity.AddChild(effect);
        }
    }
Esempio n. 4
0
    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();
        }
    }