Ejemplo n.º 1
0
    public void ProceedToCrushPressed()
    {
        for (int i = 0; i < _potionReagentsBox.GetChildCount(); i++)
        {
            //ItemSprite
            Node2D N = ((Node)_potionReagentsBox.GetChildren()[i]).GetChild(0).GetChild(0) as Node2D;

            _tween.InterpolateProperty(GetNode("MortarPestle/PickReagents"), "modulate", Colors.White, new Color(1f, 1f, 1f, 0f), .5f);
            _tween.InterpolateProperty(_proceedToCrush, "modulate", Colors.White, new Color(1f, 1f, 1f, 0f), .5f);

            Sprite reagentSprite = new Sprite()
            {
                Texture        = _potionReagents[i].IconTex,
                GlobalPosition = N.GlobalPosition + new Vector2(2f, 2f),
                Centered       = false,
                ZIndex         = -2
            };
            AddChild(reagentSprite);
            _reagentAnimSprites[i] = reagentSprite;
        }
        _tween.Start();
        _reagentAnimState = ReagentAnim.Hover;
    }
Ejemplo n.º 2
0
    public void TweenAllCompleted()
    {
        switch (_alchemyStage)
        {
        case AlchemyStage.MortarPestle:
        {
            switch (_mortarPestleStage)
            {
            case MortarPestleStage.PickReagents:
            {
                if (_reagentAnimState == ReagentAnim.Hover)
                {
                    _proceedToCrush.Disabled = true;

                    foreach (Node N in _potionReagentsBox.GetChildren())
                    {
                        N.QueueFree();
                    }

                    foreach (Sprite S in _reagentAnimSprites)
                    {
                        if (S != null)
                        {
                            _tween.InterpolateProperty(S, "global_position", S.GlobalPosition, new Vector2(160f + (float)GD.RandRange(-10, 10), 40f + (float)GD.RandRange(-10, 10)), 1f, Tween.TransitionType.Cubic);
                        }
                    }

                    _tween.Start();
                    _reagentAnimState = ReagentAnim.Fall;
                }
                else if (_reagentAnimState == ReagentAnim.Fall)
                {
                    foreach (Sprite S in _reagentAnimSprites)
                    {
                        if (S != null)
                        {
                            _tween.InterpolateProperty(S, "global_position", S.GlobalPosition, _mortar.GlobalPosition + new Vector2((float)GD.RandRange(-10, 10), (float)GD.RandRange(-10, 10)), 1.5f, Tween.TransitionType.Cubic);
                        }
                    }

                    _tween.Start();
                    _reagentAnimState = ReagentAnim.End;
                }
                else if (_reagentAnimState == ReagentAnim.End)
                {
                    NextStage();
                    for (int i = 0; i < _reagentAnimSprites.Length; i++)
                    {
                        if (_reagentAnimSprites[i] != null)
                        {
                            _reagentAnimSprites[i].QueueFree();
                            _reagentAnimSprites[i] = null;
                        }
                    }
                }
                break;
            }
            }
            break;
        }
        }
    }