Esempio n. 1
0
        private void Start()
        {
            states           = GetComponent <StateManager>();
            states.aiManager = this;

            agent = GetComponentInChildren <NavMeshAgent>();

            if (currentActionsHolder != null)
            {
                AIAction hightest = currentActionsHolder.FindHighestScoreAction(this);

                currentAction = hightest;
            }

            weaponHook = GetComponentInChildren <WeaponHook>();
            if (weaponHook != null)
            {
                weaponHook.Init();
            }
        }
Esempio n. 2
0
        public void LoadWeapon(Weapon targetWeapon)
        {
            GameObject go = Instantiate(targetWeapon.modelPrefab) as GameObject;
            Transform  rh = anim.GetBoneTransform(HumanBodyBones.RightHand);

            go.transform.parent        = rh;
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;
            WeaponHook hook = go.GetComponent <WeaponHook>();

            hook.Init(targetWeapon);
            currentWeaponHook = hook;

            GameObject aimPivot = Instantiate(targetWeapon.aimPivotPrefab) as GameObject;
            Transform  rh_ik    = aimPivot.transform.GetChild(0);

            aimPivot.transform.parent = this.transform;

            animatorHook.LoadCurrentWeapon(currentWeaponHook, aimPivot.transform, rh_ik);
        }