Ejemplo n.º 1
0
        //-------------------------WEAPON ON HAND------------------------------------
        public void PutWeaponInHand(WeaponConfig weapon)
        {
            GameObject weaponPrefab = weapon.GetWeaponPrefab();
            GameObject powerAttackParticlePrefab = weapon.GetWeaponPowerAttackGlowPrefab();

            currentWeaponInUse = weapon;
            Destroy(instantiatedWeapon);
            Transform weaponHandT = RequestDominantHand();

            instantiatedWeapon = Instantiate(weaponPrefab, weaponHandT);
            instantiatedWeapon.transform.localPosition = currentWeaponInUse.weaponGrip.localPosition;
            instantiatedWeapon.transform.localRotation = currentWeaponInUse.weaponGrip.localRotation;

            if (powerAttackParticlePrefab != null)
            {
                GameObject powerAttackParticleObj = Instantiate(powerAttackParticlePrefab, instantiatedWeapon.transform);
                powerAttackParticleObj.transform.localRotation = currentWeaponInUse.particleGrip.localRotation;
                powerAttackParticleObj.transform.localPosition = currentWeaponInUse.particleGrip.localPosition;
                particleEffectToUse = powerAttackParticleObj.GetComponent <ParticleSystem>();
            }


            //print("Put the " + weapon + " in " + gameObject + "'s hand");

            WeaponDependantAnimation();
        }