Example #1
0
        //Eject Transition
        public void PerformTransition(Transform start, Transform dst, CharState newState, bool clearActions = true)
        {
            inTransition    = true;
            transitionStart = start;
            transitionDst   = dst;
            activeBehaviour.DisableCollisions();
            ChangeState(CharState.Transition);
            transitionNewState = newState;
            if (newState == CharState.Inside)
            {
                behaviourAfterTransition = insideBehaviour;
            }
            else if (newState == CharState.Outside)
            {
                behaviourAfterTransition = outsideBehaviour;
            }
            if (clearActions)
            {
                availableActions.Clear();
            }

            /*if (newState == CharacterState.Inside)
             * {
             *  animator.SetTrigger(enterAnimKey);
             * } else
             * {
             *  animator.SetTrigger(exitAnimKey);
             * }*/
            //If going inside, character should be facing right
            //If going outside, character should be facing left
            rb2D.velocity = Vector2.zero;
            //charSpriteRenderer.flipX = newState == CharacterState.Inside;
        }
Example #2
0
 private void ActivateBehaviour(CharBehaviour newActive)
 {
     if (activeBehaviour != null)
     {
         DeactivateBehaviour();
     }
     activeBehaviour = newActive;
     activeBehaviour.Activate();
 }