Exemple #1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (ObjectsToChangeState.Count == 0)
        {
            Debug.LogWarning($"Object list for {animator.GetNextAnimatorClipInfo(layerIndex)[0].clip.name} is empty.");
        }

        foreach (string objName in ObjectsToChangeState)
        {
            GameObject obj = AnimatorStatesHelper.GetObjectWithName(objName);
            obj.SetActive(!DisableOnBeginningInstead);
        }

        if (!Occluder)
        {
            Occluder = AnimatorStatesHelper.GetOccluder();
        }
        if (AlsoDisableOccluder)
        {
            Occluder.SetActive(false);
        }
    }