Beispiel #1
0
        void Chop(GameObject obj, Chopable cc)
        {
            if ((DateTime.Now - lastChop).TotalSeconds < 2)
            {
                return;
            }

            lastChop = DateTime.Now;

            var res = API.tmp(obj, GetTemplate());

            if (res != null)
            {
                res.DestroyObject();
                foreach (var rm in res.PositiveResults)
                {
                    GameObject robj = rm
                                      .CopyParent()
                                      .CopyMaterial()
                                      .WithCollider()
                                      .Instantiate();
                    robj.GetComponent <MeshCollider>().convex = false;
                    cc.CopyTo(robj);
                }
            }
            else
            {
                Debug.Log("fail");
            }
        }
Beispiel #2
0
        public bool CopyTo(GameObject obj)
        {
            if (maxCutCount == 1)
            {
                return(false);
            }
            Chopable c = obj.AddComponent <Chopable>();

            c.tryApproximation = tryApproximation;
            c.polySeparate     = polySeparate;
            c.maxCutCount      = maxCutCount == 0 ? 0 : maxCutCount - 1;
            return(true);
        }