コード例 #1
0
ファイル: Hero.cs プロジェクト: hoffmann-jan/legend-of-pixi
    /// <summary>
    /// Reaction on action key.
    /// </summary>
    public void PerformAction()
    {
        if (!SaveGameDataSingleton.instance.inventory.sword)
        {
            return;
        }

        _anim.enabled = false;
        var renderer = GetComponent <SpriteRenderer>();

        AnimationEventDelegate.WhenTimelineEventReached += ResetSkin;

        if (SaveGameDataSingleton.instance.inventory.shield)
        {
            ShieldActionSkin.Apply(renderer, Mathf.RoundToInt(_anim.GetFloat("lookAt")));
        }
        else
        {
            EmptyActionSkin.Apply(renderer, Mathf.RoundToInt(_anim.GetFloat("lookAt")));
        }


        Sword sword = GetComponentInChildren <Sword>();

        sword.Stroke();
    }
コード例 #2
0
    /// <summary>
    /// Reaktion auf Aktionstastendruck
    /// </summary>
    public void PerformAction()
    {
        if (!SaveGameData.current.inventory.sword)
        {
            return;                                        //Kein Schwert = Kein Schlag
        }
        anim.enabled = false;

        AnimationEventDelegate.WhenTimelineEventReached += ResetSkin;

        if (SaveGameData.current.inventory.shield)
        {
            shieldActionSkin.Apply(GetComponent <SpriteRenderer>(), Mathf.RoundToInt(anim.GetFloat("lookAt")));
        }
        else
        {
            emptyActionSkin.Apply(GetComponent <SpriteRenderer>(), Mathf.RoundToInt(anim.GetFloat("lookAt")));
        }

        Sword sword = GetComponentInChildren <Sword>();

        sword.Stroke();
    }