示例#1
0
    void Awake()
    {
        m_Camera    = Camera.main;
        m_Ani       = GetComponent <Animator>();
        m_Rigidbody = GetComponent <Rigidbody>();
        m_AimSystem = GetComponent <AimSystem>();
        m_AimIK     = GetComponent <AimIK>();

        m_Weapons = new List <Weapon>();

        //Get transform of righthand
        rightHand = transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0).GetChild(2).GetChild(0).GetChild(0).GetChild(0);

        //오른손의 자식으로 설정된 무기들을 m_Weapons에 추가하고, 비활성화 시킨다.
        for (int i = 0; i < rightHand.childCount; i++)
        {
            Weapon weap = rightHand.GetChild(i).GetComponent <Weapon>();
            weap.m_ShootTarget = m_AimSystem.m_RayTarget;
            m_Weapons.Add(weap);
            weap.gameObject.SetActive(false);
        }

        m_WeaponInhand = m_Weapons[0];
        m_WeaponInhand.gameObject.SetActive(true);
        m_AimIK.SetHandsIKPosition(m_WeaponInhand.m_GrabPosRight, m_WeaponInhand.m_GrabPosLeft);
    }
示例#2
0
 // Use this for initialization
 void Awake () {
     m_Ani = GetComponent<Animator>();
     m_Aimsystem = GetComponent<AimSystem>();
     m_AimTarget = m_Aimsystem.m_RayTarget;
     m_RightShoulder = m_Ani.GetBoneTransform(HumanBodyBones.RightShoulder).transform;
     m_PlayerData = GetComponent<PlayerData>();
 }
 private void Awake()
 {
     Instance = this;
 }