Ejemplo n.º 1
0
        public static Projectile CreateProjectile(BaseProjectile baseProjectile, string prefabPath, Vector3 pos, Vector3 forward, Vector3 velocity)
        {
            GameObject gameObject = GameManager.client.CreatePrefab(prefabPath, pos, Quaternion.LookRotation(forward), false);

            if (gameObject == null)
            {
                return(null);
            }
            if (ConVar.Pool.projectiles)
            {
                gameObject.EnablePooling(StringPool.Get(prefabPath));
            }
            gameObject.AwakeFromInstantiate();
            Projectile component = gameObject.GetComponent <Projectile>();

            component.InitializeVelocity(velocity);
            component.modifier = baseProjectile.GetProjectileModifier();
            return(component);
        }