Exemplo n.º 1
0
 //
 private void DestroySetup(MoveControllerSetup setup)
 {
     if (setup != null)
     {
         setup.Stop();
     }
 }
Exemplo n.º 2
0
        /*************************************************
        *
        * SetUp Controll
        *
        *************************************************/


        //
        private void InitSetup(MoveControllerSetup setup, MoveControllerSetup predecessor, bool inheritVisual, bool inheritAnimator)
        {
            if (setup == null)
            {
                return;
            }

            setup.Init(this, predecessor, CCStateConstants.CC_STATE_DEFAULT, inheritVisual, inheritAnimator);
        }
Exemplo n.º 3
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)
        {
            mHashCode = GetHashCode();

            mConfig        = animator.GetComponent <MoveControllerSetup>();
            mDataCollector = mConfig.dataCollector;
            mMoveImpl      = mConfig.cc;

            if (mMoveData.animInfo.IsInState(layerIndex, stateInfo.fullPathHash, mHashCode))
            {
                return;
            }

            mDataCollector.UpdateAnimState(layerIndex, stateInfo.fullPathHash, mHashCode);
            StartState(mMoveData, mMoveImpl, animator, stateInfo, layerIndex);
        }
Exemplo n.º 4
0
        /*************************************************
        *
        * Life Circle
        *
        *************************************************/


        /// <summary>
        /// 启动配置,获得各个配置来源
        /// </summary>
        internal virtual void Init(RoninController controller, MoveControllerSetup predecessor,
                                   string initCCState = CCStateConstants.CC_STATE_DEFAULT, bool inheritVisual = false, bool inheritAnimator = false)
        {
            // Init Transform
            this.SetParent(controller);
            this.transform.Reset();
            gameObject.SetActive(true);

            // Init Visual
            if (inheritVisual)
            {
                visual = predecessor.visual;
                visual.SetParent(this);
            }
            else
            {
                visual = transform.GetChild(0).gameObject;
            }

            // Init CC Setting
            ccSetting = visual.GetComponent <CharacterControllerSetting>();

            // Init Attack Area
            attackAreaSetting = visual.GetComponent <AttackAreaSetting>();

            // Init CC
            cc = controller;
            cc.SetCCParams(ccSetting.ActiveSetting(initCCState));

            // Init Ability
            ability = cc.GetComponent <PlayerAbility>();

            // Init DataCollector
            dataCollector = dataCollector ?? CreateDataCollector();
            dataCollector.Init(this);

            // Init Animator
            animator = animator ?? GetComponent <Animator>();
            if (inheritAnimator)
            {
                predecessor.animator.CopyTo(animator);
            }
        }
Exemplo n.º 5
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     DestroySetup(mSetup);
     mSetup = null;
 }
Exemplo n.º 6
0
 public void Init(MoveControllerSetup setup)
 {
     mSetup = setup;
 }