コード例 #1
0
        protected virtual void SetStart()
        {
            ScaleFactor          = _transform.localScale.y;                                  //TOTALLY SCALABE animal
            MovementDetected     = false;
            Grounded             = true;
            UpdateDirectionSpeed = true;

            UseAdditivePos = true;
            //UseAdditiveRot = true;
            Inertia = Vector3.zero;
            gravityStackAceleration = 0;
            UseGravity           = true;
            UseOrientToGround    = true;
            UseCustomAlign       = false;
            LastPos              = _transform.position;
            AdditivePosition     = Vector3.zero;
            InertiaPositionSpeed = Vector3.zero;
            activeMode           = null;


            //Get the transform of the main camera



            Attack_Triggers = GetComponentsInChildren <MAttackTrigger>(true).ToList();        //Save all Attack Triggers.


            foreach (var state in states)
            {
                state.StartState();
            }


            State StartState;

            if (OverrideStartState != null)
            {
                StartState = statesD[OverrideStartState];
            }
            else
            {
                StartState = states[states.Count - 1];             //Activate the last State on the Queue on Start
            }

            activeState = StartState;                           //Set the var as Active state whitout calling the code               //Set the Last State as the Active State since is the first time
            StartState.Activate();
            AlingRayCasting();                                  //Make a first raycast

            Anim.speed = AnimatorSpeed;                         //Set the Global Animator Speed
        }