public static Entity Instantiate(EntityCommandBuffer.Concurrent ecb, int jobIndex, float3 target, Entity prefab, Entity prefabTrail, float3 pos, float3 vel, float time) { var entity = ecb.Instantiate(jobIndex, prefab); ecb.SetComponent(jobIndex, entity, new Translation { Value = pos, }); var rot = quaternion.LookRotationSafe(vel, new float3(0, 1, 0)); ecb.SetComponent(jobIndex, entity, new Rotation { Value = rot, }); ecb.SetComponent(jobIndex, entity, new MissileComponent { Target = target, Velocity = vel, }); ecb.SetComponent(jobIndex, entity, AlivePeriod.Create(time, 2f /* period */)); TrailSystem.Instantiate(ecb, jobIndex, prefabTrail, entity /* refering_entity */, pos, 0.5f /* width */, new Color(0.8f, 0.8f, 0.8f), time); return(entity); }
public void StartParticlesWithBurst() { setMainPrewarm(false); MainSystem.Play(); BurstSystem.Play(); TrailSystem.Play(); }
private void Awake() { _iniProjectileSpeed = ProjectileSpeed; _menuManager = FindObjectOfType <MenuManager>(); _menuManager.OnStartGame += StartGame; _menuManager.OnRestartGame += RestartGame; _gridSystem = FindObjectOfType <GridSystem>(); _infGrid = (InfiniteHexGrid)_gridSystem.Grid; _metronome = _gridSystem.GetComponent <Metronome>(); _metronome.Beat += Shoot; _trail = _gridSystem.GetComponent <TrailSystem>(); _position = transform.position; _player = FindObjectOfType <Player>(); var go = Resources.Load <GameObject>("Boss/Projectile"); _obstacleMask = LayerMask.GetMask("Player"); _projectiles = new Transform[ProjectilesCount]; for (int i = 0; i < ProjectilesCount; i++) { _projectiles[i] = Instantiate(go).transform; _projectiles[i].position = Vector3.one * -1000; } _lastTime = _metronome.ElapsedTime; Hp = MaxHp; }
private void Awake() { _coins = new GameObject[CoinPool * _mul]; var go = Resources.Load <GameObject>("Pool/Coin"); _menuManager = FindObjectOfType <MenuManager>(); _menuManager.OnRestartGame += RestartGame; for (int i = 0; i < CoinPool * _mul; i++) { _coins[i] = Instantiate(go); _coins[i].transform.position = Vector3.one * -1000; } _trail = FindObjectOfType <TrailSystem>(); if (_gridSystem == null) { _gridSystem = GetComponent <GridSystem>(); } _infGrid = (InfiniteHexGrid)_gridSystem.Grid; _metronome = FindObjectOfType <Metronome>(); _metronome.Beat += PopCoin; _infGrid = (InfiniteHexGrid)_gridSystem.Grid; }
private void Awake() { _pool = new GameObject[PoolSize * _mul]; _obstacles = Resources.LoadAll <GameObject>("Pool/Obstacles"); _menuManager = FindObjectOfType <MenuManager>(); _menuManager.OnRestartGame += RestartGame; for (int i = 0; i < PoolSize * _mul; i++) { _pool[i] = Instantiate(_obstacles[i % _obstacles.Length]); _pool[i].transform.position = Vector3.one * -1000; } _trail = FindObjectOfType <TrailSystem>(); if (_gridSystem == null) { _gridSystem = GetComponent <GridSystem>(); } _infGrid = (InfiniteHexGrid)_gridSystem.Grid; _metronome = FindObjectOfType <Metronome>(); _infGrid = (InfiniteHexGrid)_gridSystem.Grid; }
private void Awake() { _self = (TrailSystem)target; if (_self.GridSystem == null) { _self.GridSystem = _self.GetComponent <GridSystem>(); } }
public static void RunColony(TrailSystem <TravelToCity> system, Func <Ant <TravelToCity> > createAnt) { var result = AntColony.OptimizeCSharp(createAnt, 50, 50, system); foreach (var x in result) { Console.WriteLine(x.Destination.Name); } }
public static Entity Instantiate(Entity prefab, float3 pos, quaternion rot) { var em = World.DefaultGameObjectInjectionWorld.EntityManager; var entity = em.Instantiate(prefab); #if UNITY_EDITOR em.SetName(entity, "missile"); #endif em.SetComponentData(entity, new Translation { Value = pos, }); em.SetComponentData(entity, new Rotation { Value = rot, }); em.SetComponentData(entity, new MissileComponent { Target = new float3(0, 0, 0), }); em.SetComponentData(entity, AlivePeriod.Create(UTJ.Time.GetCurrent(), 2f /* period */)); TrailSystem.Instantiate(entity, pos, 0.5f /* width */, Color.white, new float3(0f, 0f, -0.5f) /* offset */, 4f / 60f /* update_interval */); return(entity); }
private void Start() { rb = GetComponent <Rigidbody>(); TS = GetComponent <TrailSystem>(); }
void Awake() { trailSys = new TrailSystem(); }
public void StopParticles() { MainSystem.Stop(); TrailSystem.Stop(); }
public void StartParticlesWithoutBurst() { setMainPrewarm(true); MainSystem.Play(); TrailSystem.Play(); }