コード例 #1
0
        public void InitTrackDustSystem(NodeAddedEvent evt, [Combine] TrackDustInitNode tank, SingleNode <MapDustComponent> mapDust)
        {
            TrackComponent     track     = tank.track;
            TrackDustComponent trackDust = tank.trackDust;

            trackDust.leftTrackDustDelay  = new float[track.LeftTrack.rays.Length];
            trackDust.rightTrackDustDelay = new float[track.RightTrack.rays.Length];
            CollisionDustBehaviour collisionDustBehaviour = tank.hullInstance.HullInstance.AddComponent <CollisionDustBehaviour>();

            collisionDustBehaviour.mapDust = mapDust.component;
            if (tank.Entity.HasComponent <CollisionDustComponent>())
            {
                tank.Entity.GetComponent <CollisionDustComponent>().CollisionDustBehaviour = collisionDustBehaviour;
            }
            else
            {
                tank.Entity.AddComponent(new CollisionDustComponent(collisionDustBehaviour));
            }
        }
コード例 #2
0
 public void TryEmitFromTracks(UpdateEvent evt, TrackDustUpdateNode tankNode, [JoinAll] SingleNode <MapDustComponent> mapDustNode)
 {
     if (tankNode.cameraVisibleTrigger.IsVisibleAtRange(30f))
     {
         TrackComponent         component     = tankNode.track;
         TrackDustComponent     trackDust     = tankNode.trackDust;
         ChassisConfigComponent chassisConfig = tankNode.chassisConfig;
         float            maxRayLength        = chassisConfig.MaxRayLength;
         Track            leftTrack           = component.LeftTrack;
         Track            rightTrack          = component.RightTrack;
         MapDustComponent mapDust             = mapDustNode.component;
         float[]          leftTrackDustDelay  = trackDust.leftTrackDustDelay;
         float[]          rightTrackDustDelay = trackDust.rightTrackDustDelay;
         int numRaysPerTrack = chassisConfig.NumRaysPerTrack;
         for (int i = 0; i < numRaysPerTrack; i += 2)
         {
             this.TryEmitFromSuspensionRay(maxRayLength, leftTrack, mapDust, leftTrackDustDelay, i);
             this.TryEmitFromSuspensionRay(maxRayLength, rightTrack, mapDust, rightTrackDustDelay, i);
         }
     }
 }