Exemplo n.º 1
0
    void Start()
    {
        //attach components
        _char = GetComponent <CharacterController>();
        _absoluteTransform = Camera.main.transform;
        _anim         = transform.Find("Model").GetComponent <Animator>();
        _ledgeRaycast = transform.Find("LedgeGrabRaycast");
        _cam          = GetComponent <CameraScript>();
        _aimingArch   = transform.Find("AimingArch").GetComponent <AimingArchScript>();
        _emitter      = GetComponent <AudioEmitterScript>();
        _rends        = _anim.GetComponentsInChildren <SkinnedMeshRenderer>();
        _healthUI     = transform.Find("HealthUI").GetComponent <HealthUIScript>();
        _snd          = GetComponent <SoundManager>();

        _handsIK = transform.Find("HandIK").GetComponent <HandIKTouchScript>();
        TouchIKBehaviour touchBeh = _anim.GetBehaviour <TouchIKBehaviour>();

        touchBeh.LeftHandPos  = _handsIK.LeftHand;
        touchBeh.RightHandPos = _handsIK.RightHand;

        //set tracking vars
        _aimingArchStartPos = _aimingArch.transform.localPosition;

        //dependency error
#if DEBUG
        Assert.IsNotNull(_char, "DEPENDENCY ERROR: CharacterController missing from PlayerScript");
#endif
    }
 internal void ThrowItem(AimingArchScript aimingArch)
 {
     _rb.isKinematic = false;
     _rb.AddForce(aimingArch.Direction, ForceMode.VelocityChange);
     State            = PickupItemState.Normal;
     transform.parent = null;
     _isThrown        = true;
     _snd.Play("Throw");
 }