예제 #1
0
 public void DrawBulletHitDecal(BulletHitEvent evt, Node node, [JoinByTank] SingleNode <DynamicDecalProjectorComponent> decalHitNode, [JoinByTank] SingleNode <MuzzlePointComponent> muzzlePointNode, [JoinAll] SingleNode <DecalManagerComponent> decalManagerNode)
 {
     if (decalManagerNode.component.EnableDecals && (evt is BulletStaticHitEvent))
     {
         DynamicDecalProjectorComponent decalProjector = decalHitNode.component;
         Vector3 barrelOriginWorld = new MuzzleVisualAccessor(muzzlePointNode.component).GetBarrelOriginWorld();
         base.DrawHitDecal(decalManagerNode.component, decalProjector, barrelOriginWorld, (evt.Position - barrelOriginWorld).normalized);
     }
 }
예제 #2
0
        protected GameObject DrawGraffiti(DecalManagerComponent managerComponent, DynamicDecalProjectorComponent decalProjector, Vector3 position, Vector3 direction, Vector3 up)
        {
            DecalProjection decalProjection = new DecalProjection {
                AtlasHTilesCount      = decalProjector.AtlasHTilesCount,
                AtlasVTilesCount      = decalProjector.AtlasVTilesCount,
                SurfaceAtlasPositions = decalProjector.SurfaceAtlasPositions,
                HalfSize   = decalProjector.HalfSize,
                Up         = up,
                Distantion = decalProjector.Distance,
                Ray        = new Ray(position, direction)
            };
            Mesh mesh = null;

            return(!managerComponent.DecalMeshBuilder.Build(decalProjection, ref mesh) ? null : managerComponent.GraffitiDynamicDecalManager.AddGraffiti(mesh, decalProjector.Material, decalProjector.Color, decalProjector.LifeTime));
        }
예제 #3
0
        protected void DrawHitDecal(DecalManagerComponent managerComponent, DynamicDecalProjectorComponent decalProjector, Vector3 position, Vector3 direction)
        {
            DecalProjection decalProjection = new DecalProjection {
                AtlasHTilesCount      = decalProjector.AtlasHTilesCount,
                AtlasVTilesCount      = decalProjector.AtlasVTilesCount,
                SurfaceAtlasPositions = decalProjector.SurfaceAtlasPositions,
                HalfSize   = decalProjector.HalfSize,
                Up         = decalProjector.Up,
                Distantion = decalProjector.Distance,
                Ray        = new Ray(position, direction)
            };
            Mesh mesh = null;

            if (managerComponent.DecalMeshBuilder.Build(decalProjection, ref mesh))
            {
                managerComponent.BulletHoleDecalManager.AddDecal(mesh, decalProjector.Material, decalProjector.Color, decalProjector.LifeTime);
            }
        }
예제 #4
0
 protected void DrawHitDecal(HitEvent evt, DecalManagerComponent decalManager, DynamicDecalProjectorComponent decalProjector, MuzzlePointComponent muzzlePoint)
 {
     if (evt.StaticHit != null)
     {
         Vector3 barrelOriginWorld = new MuzzleVisualAccessor(muzzlePoint).GetBarrelOriginWorld();
         this.DrawHitDecal(decalManager, decalProjector, barrelOriginWorld, (evt.StaticHit.Position - barrelOriginWorld).normalized);
     }
 }