コード例 #1
0
        public override bool IsWeaponArmingFinished(AIBrain ai)
        {
            if (ai.stateSystemAnimator.IsStartedAnimationFinished("", "LowIdle"))
            {
                // Just in case
                GunAtt gunAtt = ai.GetCurrentWeaponScript();
                if (RightHandHold && ai.HaveCurrentWeapon() && gunAtt &&
                    gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand))
                {
                    RightHandHold.localPosition = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand).localPosition;
                    RightHandHold.localRotation = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand).localRotation;

                    WeaponIK.localPosition = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AimHipFire).localPosition;
                    WeaponIK.localRotation = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AimHipFire).localRotation;
                }

                ai.CurrentWeapon.SetParent(RightHandHold, false);
                ai.CurrentWeapon.localPosition = Vector3.zero;
                ai.CurrentWeapon.localRotation = Quaternion.identity;

                return(true);
            }

            return(false);;
        }
コード例 #2
0
        virtual public void OnNewClipInLeftHand(AIBrain ai)
        {
            GunAtt gunAtt = ai.GetCurrentWeaponScript();

            // instantiate new clip in left hand
            if (gunAtt && gunAtt.curClipObject && gunAtt.curClipPrefab)
            {
                // instantiate new clip
                tempNewClip = gunAtt.InstantiateReturn(gunAtt.curClipPrefab);
                tempNewClip.SetParent(LeftHandHold, true);

                tempNewClip.localPosition = Vector3.zero;
                tempNewClip.localRotation = Quaternion.identity;

                LeftHandHold.localPosition = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.LeftHandClip).localPosition;
                LeftHandHold.localRotation = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.LeftHandClip).localRotation;

                tempNewClip.GetComponent <Rigidbody>().isKinematic = true;
                tempNewClip.GetComponent <Collider>().enabled      = false;

                gunAtt.StartCoroutine(gunAtt.FixClipPosInLHand(tempNewClip));

                return;
            }
        }
コード例 #3
0
        virtual public void OnIsHandOnGun(AIBrain ai)
        {
            GunAtt gunAtt = ai.GetCurrentWeaponScript();

            if (RightHandHold && ai.HaveCurrentWeapon() && gunAtt &&
                gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand))
            {
                RightHandHold.localPosition = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand).localPosition;
                RightHandHold.localRotation = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AnimRightHand).localRotation;

                WeaponIK.localPosition = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AimHipFire).localPosition;
                WeaponIK.localRotation = gunAtt.GetFixer(ai.Transform.name, WeaponFixerTypes.AimHipFire).localRotation;
            }

            ai.CurrentWeapon.SetParent(RightHandHold, false);
            ai.CurrentWeapon.localPosition = Vector3.zero;
            ai.CurrentWeapon.localRotation = Quaternion.identity;
        }