AnimationHandler.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
    void Start()
    {
        ApplyColor();
        //armLA.Stop ();
        //armRA.Stop ();
        armL.sprite = armLS;
        armR.sprite = armRS;

        localArmL = armL.transform.localPosition;
        localArmR = armR.transform.localPosition;
        centerR = armR.transform.parent;
        centerL = armL.transform.parent;
    }

Usage Example

Example #1
0
    public void AddAnimation(AnimationType animationType,
                             GameObject referenceGameObject,
                             bool resetToOriginal = true,
                             ScriptableObject animationSettings = null,
                             Action onComplete = null)
    {
        if (animationType == AnimationType.None)
        {
            onComplete?.Invoke();
            return;
        }

        if (!AnimationList.ContainsKey(referenceGameObject))
        {
            AnimationList.Add(referenceGameObject, new List <AnimationHandler>());
        }

        var existsAnimationHandler = AnimationList[referenceGameObject].Find(x => x.AnimationType == animationType);

        if (existsAnimationHandler != null)
        {
            StopAnimation(existsAnimationHandler.ReferenceObject, existsAnimationHandler.AnimationType);
            return;
        }

        AnimationHandler animationHandler = new AnimationHandler();

        animationHandler.AnimationType   = animationType;
        animationHandler.ReferenceObject = referenceGameObject;
        animationHandler.ResetToOriginal = resetToOriginal;
        animationHandler.OnComplete      = onComplete;
        AnimationList[referenceGameObject].Add(animationHandler);

        if (animationSettings != null)
        {
            animationHandler.AnimationSettings = animationSettings;
        }

        animationHandler.Start();
    }