Beispiel #1
0
    // public bool fallen = false;
    //private Camera camera;
    private void Awake()
    {
        //inputAction = new InputActions();
        // inputAction.PlayerControls.Move.performed += ctx => movementInput = ctx.ReadValue<Vector2>();
        cf  = GetComponent <ConfigurableJoint>();
        jtd = GetComponent <JointTargetDisabler>();
        //inputAction.PlayerControls.Tackle.performed += ctx => tackle = ctx.ReadValue<float>();

        //set joint drive values
        jd  = new JointDrive();
        jd0 = new JointDrive();
        jd.positionSpring  = 10000;
        jd.positionDamper  = 200;
        jd.maximumForce    = 10000;
        jd0.positionDamper = 0;
        jd0.positionSpring = 0;
        jd0.maximumForce   = 0;


        //disable collisions with controller collider and self
        myCollider = GetComponent <Collider>();
        foreach (Collider d in gameObject.GetComponentsInChildren <Collider>())
        {
            Physics.IgnoreCollision(myCollider, d);
        }
    }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     myRigidbody        = GetComponent <Rigidbody>();
     topGO              = topRigidbody.gameObject;
     topCJ              = topGO.GetComponent <ConfigurableJoint>();
     jd                 = new JointDrive();
     jd0                = new JointDrive();
     jd.positionSpring  = 10000;
     jd.positionDamper  = 200;
     jd.maximumForce    = 10000;
     jd0.positionDamper = 0;
     jd0.positionSpring = 0;
     jd0.maximumForce   = 0;
     jtd                = topGO.GetComponent <JointTargetDisabler>();
     pc                 = topGO.GetComponent <PlayerControllerDummy>();
 }
Beispiel #3
0
    private void Awake()
    {
        inputAction = new InputActions();
        inputAction.PlayerControls.Move.performed += ctx => movementInput = ctx.ReadValue <Vector2>();
        cf  = GetComponent <ConfigurableJoint>();
        jtd = GetComponent <JointTargetDisabler>();
        //inputAction.PlayerControls.Tackle.performed += ctx => tackle = ctx.ReadValue<float>();

        //set joint drive values
        jd  = new JointDrive();
        jd0 = new JointDrive();
        jd.positionSpring     = 10000;
        jd.positionDamper     = 200;
        jd.maximumForce       = 10000;
        jd0.positionDamper    = 0;
        jd0.positionSpring    = 0;
        jd0.maximumForce      = 0;
        jdGrad.positionDamper = 200;
        jdGrad.positionSpring = 10000;
        jdGrad.maximumForce   = 10000;
        myCollider            = GetComponent <Collider>();
        myRigidbody           = GetComponent <Rigidbody>();

        //disable collisions with controller collider and self
        foreach (Collider d in gameObject.GetComponentsInChildren <Collider>())
        {
            Physics.IgnoreCollision(myCollider, d);
        }

        camera          = GameObject.FindGameObjectWithTag("MainCamera");
        stateMachine    = new StateMachine();
        standingUpState = gameObject.AddComponent <StandingUp>();
        standingUpState.Initialize(this, stateMachine, "StandingUp");
        idleState = gameObject.AddComponent <Idle>();
        idleState.Initialize(this, stateMachine, "Idle");
        tacklingState = gameObject.AddComponent <Tackling>();
        tacklingState.Initialize(this, stateMachine, "Tackling");
        recoveringState = gameObject.AddComponent <Recovering>();;
        recoveringState.Initialize(this, stateMachine, "Recovering");
        movingState = gameObject.AddComponent <Moving>();;
        movingState.Initialize(this, stateMachine, "Moving");
        fallenState = gameObject.AddComponent <Fallen>();
        fallenState.Initialize(this, stateMachine, "Fallen");
        stateMachine.Initialize(idleState);
    }