protected override void OnHit(Collision other)
        {
            PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects);
            ContactPoint first = other.GetContact(0);

            SpawnExplosion(first.point, first.normal);
        }
Ejemplo n.º 2
0
 private void FixedUpdate()
 {
     foreach (var item in tracks)
     {
         if (Physics.Raycast(item.position + Vector3.up / 4, Vector3.down / 3, out RaycastHit hit, 1f))
         {
             PaintableMesh.HandlePainting(hit, trackBrush.Texture, trackBrush.Affects);
         }
     }
 }
 protected override void OnHit(Collision other)
 {
     if (!activated)
     {
         StartCoroutine(StartCounter());
     }
     else if (armed)
     {
         PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects);
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 4
0
        private ObjectPaint CreateTulp(PaintableMesh mesh)
        {
            var Tulp = new ObjectPaint();

            Tulp.Mesh = mesh;

            var list = new List <LocalPaintAmount>();

            foreach (var Global in GlobalPaintAmounts)
            {
                LocalPaintAmount a = new LocalPaintAmount(Global);
                list.Add(a);
            }
            Tulp.PaintAmounts = list.ToArray();
            return(Tulp);
        }
Ejemplo n.º 5
0
 protected virtual void OnHit(Collision other)
 {
     if ((brush.Affects.value & 1 << other.gameObject.layer) != 0)
     {
         PaintableMesh.HandlePainting(other, brush.Texture, brush.Affects);
         if (hitVFX != null)
         {
             var a = Instantiate(hitVFX, other.GetContact(0).point, Quaternion.Euler(other.GetContact(0).normal));
             a.Activate();
         }
         if (hitCount == 0)
         {
             if (objectDestruction != null)
             {
                 StopCoroutine(objectDestruction);
             }
             rigidbody.velocity = rigidbody.velocity / 100;
             objectDestruction  = StartCoroutine(DestroyAfterTime(0.4f));
         }
         hitCount++;
     }
 }