Esempio n. 1
0
        public void SoundOriginStart(ref RigidBodyComponents rigidBodyComponents, ref SoundProperties soundProperties, ref Timer timer)
        {
            OnlineObjectsStart(ref rigidBodyComponents);
            World.Active.EntityManager.SetComponentData(entity, soundProperties);
            World.Active.EntityManager.SetComponentData(entity, timer);
            transform.position = rigidBodyComponents.position;
            initialPosition    = rigidBodyComponents.position;
            float radius = soundProperties.radius - 0.5f;
            var   shape  = soundParticleSystem.shape;

            shape.radius = radius;


            var trails = soundParticleSystem.trails;

            trails.widthOverTrail = soundProperties.width;

            var main = soundParticleSystem.main;

            main.startLifetime = timer.maxT;
            var color = main.startColor = soundProperties.baseColor;

            syncMap = soundProperties.syncMap;
            soundParticleSystem.Emit(soundProperties.branchCount);
        }
Esempio n. 2
0
        public void Start()
        {
            entityManager = World.Active.EntityManager;
            soundOriginEntityArchetype = entityManager.CreateArchetype(
                typeof(Timer),
                typeof(Translation),
                typeof(SoundProperties));


            timerReset = new Timer
            {
                isOn = true,
                maxT = 0,
                T    = 0
            };

            soundPropertiesReset = new SoundProperties
            {
                syncMap     = false,
                branchCount = 0,
                baseColor   = Color.white,
                actualColor = Color.white
            };

            rigidBodyComponentsReset = new RigidBodyComponents
            {
                position = Vector3.zero,
                rotation = Quaternion.identity
            };

            soundPool = new List <SoundOrigin>();

            if (Application.isEditor)
            {
                poolScene = SceneManager.GetSceneByName(name);
                if (poolScene.isLoaded)
                {
                    GameObject[] rootObjects = poolScene.GetRootGameObjects();
                    for (int i = 0; i < rootObjects.Length; i++)
                    {
                        SoundOrigin pooledSound = rootObjects[i].GetComponent <SoundOrigin>();
                        if (pooledSound != null && !pooledSound.gameObject.activeSelf)
                        {
                            soundPool.Add(pooledSound);
                        }
                    }
                    return;
                }
            }
            poolScene = SceneManager.CreateScene(name);
        }