コード例 #1
0
 // Use this for initialization
 void Start()
 {
     DisableUI();
     gameObject.GetComponent <Collider2D>().enabled = true;
     HeartUI     = GameObject.Find("HealthUI");
     heartScript = HeartUI.GetComponent <HealthUIScript>();
 }
コード例 #2
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
    }
コード例 #3
0
ファイル: Health.cs プロジェクト: shifatkhan/Mario64-Unity
    private void Start()
    {
        initHealth  = health;
        rb          = GetComponent <Rigidbody>();
        renderer    = GetComponentInChildren <Renderer>();
        audioSource = GetComponent <AudioSource>();

        if (gameObject.CompareTag("Player"))
        {
            healthUI = GameObject.FindGameObjectWithTag("UI").GetComponent <HealthUIScript>();
        }
    }