// Token: 0x0600005A RID: 90 RVA: 0x000038B4 File Offset: 0x00001AB4
    private void DrawProxy(ColliderProxy proxy, ref GameObject proxyFab1)
    {
        CBaseShape  collider    = proxy.Prefab.collider;
        Transform2D transform2D = proxy.Transform2D + proxy.Prefab.transform;
        EShape2D    typeId      = (EShape2D)collider.TypeId;
        EShape2D    eshape2D    = typeId;

        if (eshape2D != EShape2D.Circle)
        {
            if (eshape2D == EShape2D.OBB)
            {
                proxyFab1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
                proxyFab1.transform.SetParent(base.transform, false);
                proxyFab1.transform.localScale    = ((collider as COBB).size * 2).ToVector3XZ(proxy.Height);
                proxyFab1.transform.localPosition = transform2D.Pos3.ToVector3();
                proxyFab1.transform.rotation      = Quaternion.Euler(0f, transform2D.deg.ToFloat(), 0f);
            }
        }
        else
        {
            proxyFab1 = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
            proxyFab1.transform.SetParent(base.transform, false);
            float num = (collider as CCircle).radius.ToFloat() * 2f;
            proxyFab1.transform.localScale    = new Vector3(num, 2f, num);
            proxyFab1.transform.localPosition = transform2D.Pos3.ToVector3();
        }
    }
示例#2
0
 private void DebugTest()
 {
     foreach (var pair in allPairs)
     {
         var hasCollidedOthers = ColliderProxy.TestColliderProxy(pair[0], pair[1]);
         pair[0].mat.color = hasCollidedOthers ? Color.red : Color.white;
         pair[1].mat.color = hasCollidedOthers ? Color.red : Color.white;
     }
 }
示例#3
0
        // Token: 0x0600027A RID: 634 RVA: 0x00007974 File Offset: 0x00005B74
        public void AttachToColSystem(int layer, ColliderPrefab prefab, object entity)
        {
            ColliderProxy colliderProxy = new ColliderProxy();

            colliderProxy.EntityObject = entity;
            colliderProxy.IsStatic     = false;
            colliderProxy.LayerType    = layer;
            this.collisionSystem.AddCollider(colliderProxy);
        }
示例#4
0
 // Token: 0x06000279 RID: 633 RVA: 0x00007924 File Offset: 0x00005B24
 public void InitStaticColliders(ColliderData[] datas)
 {
     foreach (ColliderData colliderData in datas)
     {
         ColliderProxy colliderProxy = new ColliderProxy();
         colliderProxy.EntityObject = null;
         colliderProxy.IsStatic     = true;
         colliderProxy.LayerType    = 0;
         this.collisionSystem.AddCollider(colliderProxy);
     }
 }
示例#5
0
        public override void OnToolActivated()
        {
            sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            sphere.transform.SetParent(this.transform);
            sphere.transform.localScale       = new Vector3(0.007f, 0.007f, 0.007f);
            sphere.transform.localPosition    = Vector3.forward * 0.05f;
            sphere.transform.localEulerAngles = Vector3.zero;
            sphere.GetComponent <SphereCollider>().isTrigger = true;
            ColliderProxy colliderproxy = sphere.AddComponent <ColliderProxy>();

            colliderproxy.OnCollisionStart += OnSphereCollisionStart;
            colliderproxy.OnCollisionEnd   += OnSphereCollisionStop;
            objectplacementCanvas.SetActive(true);
            containerselectionCanvas.SetActive(false);
            sectionselectionCanvas.SetActive(false);

            _controller = GetComponent <VRTK_ControllerEvents>();
            _controller.TouchpadPressed  += OnTriggerClicked;
            _controller.TouchpadReleased += OnTriggerReleased;

            textmesh = containerselectionCanvas.GetComponent <VRContainerUIRef>().centertext;

            sectionselectiontextmesh      = sectionselectionCanvas.GetComponent <VRContainerUIRef>().centertext;
            selectiondisplayID            = 1;
            sectionselectiontextmesh.text = "1";
            containersList = new Dictionary <int, VRContainer>();

            ReloadContainers();

            CloudSelector.instance.OnSelectionChange += ReloadContainers;
            CloudStorage.instance.OnCloudCreated     += ReloadContainers;
            //CloudStorage.instance.OnCloudDeleted += ReloadContainers;

            /**
             * if (containersList == null)
             * {
             *  containersList = new Dictionary<int, VRContainer>();
             *  CreateContainer(0);
             *  selectedContainerID = 0;
             *  UIdisplayID = 0;
             *
             *  textmesh.text = "0";
             *  pointNumber = 0;
             *
             * }
             * else
             * {
             *  pointNumber = containersList[selectedContainerID].GetObjectCount();
             * }
             **/

            //CloudSelector.instance.OnSelectionChange += ReloadPointList;
        }
        public static void GlobalOnTriggerEvent(ColliderProxy a, ColliderProxy b, ECollisionEvent type)
        {
            if (_colProxy2Mono.TryGetValue(a, out var handlera))
            {
                CollisionSystem.TriggerEvent(handlera, b, type);
            }

            if (_colProxy2Mono.TryGetValue(b, out var handlerb))
            {
                CollisionSystem.TriggerEvent(handlerb, a, type);
            }
        }
示例#7
0
 //private static readonly HashSet<Entity> _tempEntities = new HashSet<Entity>();
 private void _OnTriggerEnter(ColliderProxy other)
 {
     if (CurPart.collider.IsCircle && CurPart.collider.deg > 0)
     {
         var deg     = (other.Transform2D.pos - entity.transform.pos).ToDeg();
         var degDiff = entity.transform.deg.Abs() - deg;
         if (LMath.Abs(degDiff) <= CurPart.collider.deg)
         {
             _tempEntities.Add(other.Entity);
         }
     }
     else
     {
         _tempEntities.Add(other.Entity);
     }
 }
示例#8
0
 private void _OnTriggerEnter(ColliderProxy other)
 {
     if (_curPart.collider.IsCircle && _curPart.collider.deg > 0)
     {
         var deg     = (other.Transform2D.pos - owner.transform.pos).ToDeg();
         var degDiff = owner.transform.deg.Abs() - deg;
         if (LMath.Abs(degDiff) <= _curPart.collider.deg)
         {
             _tempTargets.Add(other);
         }
     }
     else
     {
         _tempTargets.Add(other);
     }
 }
示例#9
0
        // Token: 0x0600026E RID: 622 RVA: 0x00007778 File Offset: 0x00005978
        public static void GlobalOnTriggerEvent(ColliderProxy a, ColliderProxy b, ECollisionEvent type)
        {
            ILPTriggerEventHandler a2;
            bool flag = PhysicService._colProxy2Mono.TryGetValue(a, out a2);

            if (flag)
            {
                CollisionSystem.TriggerEvent(a2, b, type);
            }
            ILPTriggerEventHandler a3;
            bool flag2 = PhysicService._colProxy2Mono.TryGetValue(b, out a3);

            if (flag2)
            {
                CollisionSystem.TriggerEvent(a3, a, type);
            }
        }
示例#10
0
        /// <summary>
        /// Use this for initialization
        /// </summary>
        protected virtual void Start()
        {
            // Create a trigger proxy so this interactable can tell when the
            // character enters the area.
            if (_TriggerCollider != null)
            {
                mTriggeredList = new List <Collider>();

                ColliderProxy lProxy = _TriggerCollider.gameObject.GetComponent <ColliderProxy>();
                if (lProxy == null)
                {
                    lProxy = _TriggerCollider.gameObject.AddComponent <ColliderProxy>();
                }

                lProxy.Target = gameObject;
            }
        }
示例#11
0
        public override void InitializeWeapon()
        {
            base.InitializeWeapon();

            if (meleeCollider)
            {
                meleeColliderProxy = meleeCollider.gameObject.AddComponent <ColliderProxy>();            //Create a proxy to comunicate the Collision and trigger events in case the melee conllider is on another gameObject

                if (meleeCollider.isTrigger)
                {
                    meleeColliderProxy.OnTrigger_Stay.AddListener(WeaponTriggerStay);
                }
                else
                {
                    meleeColliderProxy.OnCollision_Enter.AddListener(WeaponCollisionEnter);
                }
            }
        }
示例#12
0
        public void AttachToColSystem(int layer, ColliderPrefab prefab, BaseEntity entity)
        {
            var proxy = new ColliderProxy();

            proxy.EntityObject = entity;
            proxy.Init(prefab, entity.transform);
            proxy.IsStatic  = false;
            proxy.LayerType = layer;
            var eventHandler = entity;

            if (eventHandler != null)
            {
                _mono2ColProxy[eventHandler] = proxy;
                _colProxy2Mono[proxy]        = eventHandler;
            }

            collisionSystem.AddCollider(proxy);
        }
    // Token: 0x06000059 RID: 89 RVA: 0x00003834 File Offset: 0x00001A34
    private void Update()
    {
        bool flag = !this.isShowStaticCollision;

        if (!flag)
        {
            bool flag2 = PhysicService.Instance != null;
            if (flag2)
            {
                ColliderProxy _DebugColProxy  = CollisionSystem.__DebugColProxy1;
                ColliderProxy _DebugColProxy2 = CollisionSystem.__DebugColProxy2;
                Object.Destroy(this.proxyFab1);
                Object.Destroy(this.proxyFab2);
                bool flag3 = _DebugColProxy != null && _DebugColProxy2 != null;
                if (flag3)
                {
                    this.DrawProxy(_DebugColProxy, ref this.proxyFab1);
                    this.DrawProxy(_DebugColProxy2, ref this.proxyFab2);
                }
            }
        }
    }
示例#14
0
 public virtual void OnLPTriggerStay(ColliderProxy other)
 {
 }
示例#15
0
 public virtual void OnLPTriggerExit(ColliderProxy other)
 {
 }
示例#16
0
 public void RemoveCollider(ColliderProxy collider)
 {
     collisionSystem.RemoveCollider(collider);
 }
示例#17
0
 public override void OnLPTriggerExit(ColliderProxy other)
 {
     Debug.Trace($"{EntityId} OnLPTriggerExit {other.Entity.EntityId}");
     playerInRange = false;
 }
示例#18
0
 public override void OnLPTriggerStay(ColliderProxy other)
 {
 }
示例#19
0
 public override void OnLPTriggerEnter(ColliderProxy other)
 {
     Debug.Trace($"{EntityId} OnLPTriggerEnter {other.Entity.EntityId}");
     playerInRange = true;
 }
示例#20
0
 /// <summary>
 /// Called when the object is selected in the editor
 /// </summary>
 private void OnEnable()
 {
     // Grab the serialized objects
     mTarget   = (ColliderProxy)target;
     mTargetSO = new SerializedObject(target);
 }