Exemplo n.º 1
0
    protected virtual void Initialization()
    {
        State            = new DHPhysicsControllerState();
        behaviourManager = GetComponent <BasicBehaviour>();
        input            = behaviourManager.LinkedInputManager;
        _rigidbody       = behaviourManager.GetRigidBody;
        animator         = behaviourManager.GetAnimator;
        mainCamara       = behaviourManager.Getcamera;
        _rigidbody       = behaviourManager.GetRigidBody;

        frictionPhysics                 = new PhysicMaterial();
        frictionPhysics.name            = "frictionPhysics";
        frictionPhysics.staticFriction  = .25f;
        frictionPhysics.dynamicFriction = .25f;
        frictionPhysics.frictionCombine = PhysicMaterialCombine.Multiply;

        maxFrictionPhysics                 = new PhysicMaterial();
        maxFrictionPhysics.name            = "maxFrictionPhysics";
        maxFrictionPhysics.staticFriction  = 1f;
        maxFrictionPhysics.dynamicFriction = 1f;
        maxFrictionPhysics.frictionCombine = PhysicMaterialCombine.Maximum;

        slippyPhysics                 = new PhysicMaterial();
        slippyPhysics.name            = "slippyPhysics";
        slippyPhysics.staticFriction  = 0f;
        slippyPhysics.dynamicFriction = 0f;
        slippyPhysics.frictionCombine = PhysicMaterialCombine.Minimum;

        _capsuleCollider = GetComponent <CapsuleCollider>();

        colliderCenter = GetComponent <CapsuleCollider>().center;
        colliderRadius = GetComponent <CapsuleCollider>().radius;
        colliderHeight = GetComponent <CapsuleCollider>().height;
    }
Exemplo n.º 2
0
    protected virtual void Initialization()
    {
        Debug.Log(gameObject.name);
        _controller          = GetComponent <DHPhysicsController>();
        movementState        = new DHStateMachine <CharacterStates.MovementStates>(gameObject, SendStateChangeEvents);
        conditionState       = new DHStateMachine <CharacterStates.CharacterConditions>(gameObject, SendStateChangeEvents);
        overridingBehaviours = GetComponents <GenericBehaviour>();
        mainCamera           = Camera.main.GetComponent <CameraMMO>();
        animator             = GetComponent <Animator>();
        rBody = GetComponent <Rigidbody>();
        GetInputManager();

        if (animator != null)
        {
            InitializeAnimatorParameters();
        }
    }