예제 #1
0
#pragma warning restore 0169

        protected override void OnUpdate()
        {
            PlayerSystem.Sync();
            var            spawner = ECSSightManager.GetSightSpawnDataQueue();
            SightSpawnData data;

            while (spawner.TryDequeue(out data))
            {
                ECSSightManager.spawn(PostUpdateCommands,
                                      Time.GetCurrent(),
                                      ref data);
            }
        }
예제 #2
0
 protected override void OnUpdate()
 {
     if (Random.Range(0, 100) < 2)
     {
         Assert.AreEqual(parent_group_.Length, 1);
         for (var i = 0; i < parent_group_.Length; ++i)
         {
             var time = Time.GetCurrent();
             ECSSightManager.spawnSight(PostUpdateCommands,
                                        time,
                                        parent_group_.entity_array_[i]);
         }
     }
 }
예제 #3
0
        void OnEnable()
        {
            sight_spawn_data_queue_ = new NativeQueue <SightSpawnData>(Allocator.Persistent);

            var entity_manager = World.Active.GetOrCreateManager <EntityManager>();

            arche_type_ = entity_manager.CreateArchetype(typeof(Destroyable)
                                                         , typeof(AlivePeriod)
                                                         , typeof(StartTime)
                                                         , typeof(Sight)
                                                         , typeof(LocalToWorld)
                                                         , typeof(Frozen)
                                                         , typeof(CustomMeshInstanceRenderer)
                                                         // , typeof(MeshInstanceRenderer)
                                                         );
            material_sight_ = new Material(material_.shader);
            material_sight_.enableInstancing = true;

            Vector3[] vertices = new Vector3[8];
            for (var i = 0; i < vertices.Length; ++i)
            {
                vertices[i] = Vector3.zero;
            }
            int[] triangles = new int[24] {
                6, 7, 2,
                2, 7, 3,
                5, 4, 1,
                1, 4, 0,
                4, 6, 0,
                0, 6, 2,
                7, 5, 3,
                3, 5, 1,
            };

            mesh_           = new Mesh();
            mesh_.vertices  = vertices;
            mesh_.triangles = triangles;
            mesh_.bounds    = new Bounds(Vector3.zero, Vector3.one * 99999999);
            instance_       = GameObject.Find("sight_manager").GetComponent <ECSSightManager>();
        }
예제 #4
0
 public void Execute(int i)
 {
     ECSSightManager.spawnSight(command_buffer_,
                                time_,
                                sight_parent_entity_array_[0]);
 }