Ejemplo n.º 1
0
        void Reset()
        {
            MalbersTools.SetLayer(transform, 20);     //Set all the Childrens to Animal Layer   .
            gameObject.tag = "Animal";                //Set the Animal to Tag Animal
            AnimatorSpeed  = 1;

            Anim = GetComponentInParent <Animator>();           //Cache the Animator
            RB   = GetComponentInParent <Rigidbody>();          //Catche the Rigid Body

            if (RB == null)
            {
                RB                        = gameObject.AddComponent <Rigidbody>();
                RB.useGravity             = false;
                RB.constraints            = RigidbodyConstraints.FreezeRotation;
                RB.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
            }

            speedSets = new List <MSpeedSet>(1)
            {
                new MSpeedSet()
                {
                    name = "Ground",
                    StartVerticalIndex = new Scriptables.IntReference(1),
                    TopIndex           = new Scriptables.IntReference(2),
                    states             = new  List <StateID>(2)
                    {
                        MalbersTools.GetInstance <StateID>("Idle"), MalbersTools.GetInstance <StateID>("Locomotion")
                    },
                    Speeds = new  List <MSpeed>(3)
                    {
                        new MSpeed("Walk", 1, 4, 4), new MSpeed("Trot", 2, 4, 4), new MSpeed("Run", 3, 4, 4)
                    }
                }
            };

            BoolVar  useCameraInp = MalbersTools.GetInstance <BoolVar>("Global Camera Input");
            BoolVar  globalSmooth = MalbersTools.GetInstance <BoolVar>("Global Smooth Vertical");
            FloatVar globalTurn   = MalbersTools.GetInstance <FloatVar>("Global Turn Multiplier");

            if (useCameraInp != null)
            {
                useCameraInput.Variable = useCameraInp;
            }
            if (globalSmooth != null)
            {
                SmoothVertical.Variable = globalSmooth;
            }
            if (globalTurn != null)
            {
                TurnMultiplier.Variable = globalTurn;
            }

            CalculateHeight();
        }
Ejemplo n.º 2
0
        void Reset()
        {
            MalbersTools.SetLayer(transform, 20);     //Set all the Childrens to Animal Layer   .
            gameObject.tag = "Animal";                //Set the Animal to Tag Animal
            AnimatorSpeed  = 1;

            speedSets = new List <MSpeedSet>(1)
            {
                new MSpeedSet()
                {
                    name = "Ground",
                    StartVerticalIndex = new Scriptables.IntReference(1),
                    TopIndex           = new Scriptables.IntReference(2),
                    states             = new  List <StateID>(2)
                    {
                        MalbersTools.GetInstance <StateID>("Idle"), MalbersTools.GetInstance <StateID>("Locomotion")
                    },
                    Speeds = new  List <MSpeed>(3)
                    {
                        new MSpeed("Walk", 0, 4, 4), new MSpeed("Trot", 0, 4, 4), new MSpeed("Run", 0, 4, 4)
                    }
                }
            };
        }
Ejemplo n.º 3
0
 private void Reset()
 {
     MalbersTools.SetLayer(transform, 20);     //Set all the Childrens to Animal Layer.
     gameObject.tag = "Animal";
 }