protected override JobHandle OnUpdate(JobHandle inputDeps) { EntityCommandBuffer entityCommandBuffer = endSimulationEntityCommandBufferSystem.CreateCommandBuffer(); JobHandle jobHandle = new EnemyTrigger { tagPlayerComponentDataFromEntity = GetComponentDataFromEntity <Tag_Player>(), tagEnemyComponentDataFromEntity = GetComponentDataFromEntity <RacingEnemy>(), tagWallComponentDataFromEntity = GetComponentDataFromEntity <Tag_Wall>(), entityCommandBuffer = entityCommandBuffer, }.Schedule(stepPhysicsWorld.Simulation, ref buildPhysicsWorld.PhysicsWorld, inputDeps); endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(jobHandle); /*I just noticed I had a system where I was using a command buffer to add a component inside a job and I forgot to call AddJobHandleForProducer(); but everything still worked correctly. * Is that call no longer needed? Or did I just get lucky with the order of the Systems? Does it depend on which buffer system I'm using, in this case EndSimulationEntityCommandBufferSystem? * */ /* * Entities.WithAll<Tag_GameOver>().ForEach((Entity entity) => { * UnityEngine.Debug.Log("Game Over!"); * }).Run(); * //*/ return(jobHandle); }
void Start() { iniSpeed = speed; rb = GetComponent <Rigidbody2D>(); GetPlayerTransform(); trigger = GetComponentInChildren <EnemyTrigger>(); }
private void Reset() { PatrolSpeed = 4f; PatrolTime = 2f; PatrolOffset = 0f; MovingRight = true; AgroRange = 10f; AgroSpeed = 5f; OnAgroClip = null; OnDeathClip = null; UseTrigger = false; SpawnTrigger = null; }
private void EnableEnemy(GameObject enemy) { EnemyTrigger eT = enemy.GetComponentInChildren <EnemyTrigger>(); eT.active = true; Collider2D[] enemyColliders = enemy.GetComponentsInChildren <Collider2D>(); for (int i = 0; i < enemyColliders.Length; i++) { enemyColliders[i].enabled = true; } NeedleAI n = enemy.GetComponent <NeedleAI>(); WaspAI w = enemy.GetComponent <WaspAI>(); BatAI b = enemy.GetComponent <BatAI>(); MoleAI m = enemy.GetComponent <MoleAI>(); SlugAI s = enemy.GetComponent <SlugAI>(); if (n != null) { n.enabled = true; } else if (w != null) { w.enabled = true; } else if (b != null) { b.enabled = true; } else if (m != null) { m.enabled = true; } else if (s != null) { s.enabled = true; } else { Debug.LogWarning(enemy + " is no enemy"); } }
void FixedUpdate() { EnemyTrigger.EnemyAggro(); }
private void Start() { trigger = gameObject.GetComponentInChildren <EnemyTrigger>(); }
public void AddTrigger(EnemyTrigger trigger) { allTriggers.Add(trigger); }
public void Init(EnemyTrigger trigger) { this.enemyTrigger = trigger; }