Ejemplo n.º 1
0
        //   List<BzKnife> bzKifesList = new List<BzKnife>();
        //TODO IENUMERATORS CANT BE CALLED ON A INACTIVATED OBJECT - WE MESS UP THE ORDER OF NET_OBJECTLIST NOT DOING IT AS SOON AS IT IS DONE THIS WILL NOT WORK
        //public void OnEnable()
        //{
        //    foreach (var kn in bzKifesList)
        //    {
        //        StartCoroutine(Slice(kn));
        //    }
        //}
        private IEnumerator Slice(BzKnife knife)
        {
            // The call from OnTriggerEnter, so some object positions are wrong.
            // We have to wait for next frame to work with correct values
            yield return(null);

            Vector3 point  = GetCollisionPoint(knife);
            Vector3 normal = Vector3.Cross(knife.MoveDirection, knife.BladeDirection);
            Plane   plane  = new Plane(normal, point);


            try
            {
                if (entityData == null)
                {
                    entityData = GetComponent <Net_Register_GameObject>().entity_data;
                }

                UnityEngine.Debug.Log("Entity ID : " + entityData.entityID + " : " + "BladeDir :" + knife.BladeDirection.ToString("F2") + " MoveDIR: " + knife.MoveDirection.ToString("F2") + "Origin" + knife.Origin.ToString("F2"));
            }
            catch { }
            //To simulate this for everyone else, we need: knife origin, knife movedirection and knife blade direction



            if (_sliceableAsync != null)
            {
                _sliceableAsync.Slice(plane, knife.SliceID, null);
            }
        }
Ejemplo n.º 2
0
        //wrong?
        private void SliceNew(BzKnife knife)
        {
            // The call from OnTriggerEnter, so some object positions are wrong.
            // We have to wait for next frame to work with correct values
            //  yield return null;
            //  print("I AM PRESENT");

            //CHANGE GETCOLLISION SECOND ARGUMENT YOU ARE REFERING TO THE MAIN OBJECT ALREADY
            Vector3 point  = GetCollisionPoint(knife);//GetCollisionPointNew(knife, knife.CustomCollisionPoint);
            Vector3 normal = Vector3.Cross(knife.MoveDirection, knife.BladeDirection);
            Plane   plane  = new Plane(normal, point);

            //  print("I AM PRESENT");
            entityData = GetComponent <Net_Register_GameObject>().entity_data;
            // UnityEngine.Debug.Log("Entity ID : " + entityData.entityID + " : " + "BladeDir :" + knife.BladeDirection + " MoveDIR: " + knife.MoveDirection + "Origin" + knife.Origin);

            UnityEngine.Debug.Log("Entity ID : " + entityData.entityID + " : " + "BladeDir :" + knife.BladeDirection.ToString("F2") + " MoveDIR: " + knife.MoveDirection.ToString("F2") + "Origin" + knife.Origin.ToString("F2"));



            if (_sliceableAsync != null)
            {
                //    print("I AM PRESENT");
                _sliceableAsync.Slice(plane, knife.SliceID, null);
            }
            else
            {
                _sliceableAsync = GetComponent <IBzSliceableNoRepeat>();
                entityData      = GetComponent <Net_Register_GameObject>().entity_data;

                _sliceableAsync.Slice(plane, knife.SliceID, null);
            }
        }
Ejemplo n.º 3
0
        private IEnumerator Slice(BzKnife knife)
        {
            // The call from OnTriggerEnter, so some object positions are wrong.
            // We have to wait for next frame to work with correct values
            yield return(null);

            Vector3 point  = GetCollisionPoint(knife);
            Vector3 normal = Vector3.Cross(knife.MoveDirection, knife.BladeDirection);
            Plane   plane  = new Plane(normal, point);

            if (_sliceableAsync != null)
            {
                _sliceableAsync.Slice(plane, knife.SliceID, null);
            }
        }