Inheritance: Collider
Exemple #1
0
 public UnityBoxCollider(GameObject obj)
 {
     box = obj.GetComponent<BoxCollider>();
     if (null == box) {
         box = obj.AddComponent<BoxCollider>();
     }
 }
Exemple #2
0
 void Awake()
 {
     //punchParticles = GetComponent<ParticleSystem> ();
     punchAudio = GetComponent<AudioSource> ();
     boxCollider = GetComponent<BoxCollider> ();
     //anim = GetComponent<Animation> ();
 }
Exemple #3
0
 void Awake()
 {
     cl = (GetComponent<BoxCollider>()) ?? gameObject.AddComponent<BoxCollider>();
     //cl.center = new Vector3(0,(float)depth/2-height,0);
     //cl.size = new Vector3(2048f,(float)depth,2048f);
     cl.isTrigger = true;
 }
 static public int get_size(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.size);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 protected override void Start()
 {
     base.Start();
     laserMesh = transform.FindChild("Laser").gameObject.GetComponent<MeshRenderer>();
     laserCollider = transform.FindChild("Laser").gameObject.GetComponent<BoxCollider>();
     mirrorSync = GetComponent<spt_mirrorSync>();
 }
            private void OnDrawGizmos()
            {
                if (_shouldRender == false)
                    return;

                if (this._collider == null)
                {
                    this._collider = this.gameObject.transform.GetComponent<BoxCollider>();
                }

                if (this._collider == null)
                {
                    return;
                }

                if (this._shouldRenderOnlyWhenSelected == true)
                {
                    if (UnityEditor.Selection.activeTransform == null)
                    {
                        return;
                    }

                    if (UnityEditor.Selection.activeTransform.GetComponentsInChildren<Transform>(true).Contains(this.transform) == false)
                    {
                        return;
                    }
                }

                Matrix4x4 gizmoMatrix = Matrix4x4.TRS(this.transform.position, this.transform.rotation, this.transform.lossyScale);
                Gizmos.matrix = gizmoMatrix;
                Gizmos.color = this._volumeColor;

                Gizmos.DrawCube(this._collider.center, this._collider.size);
            }
        public override void OnStart(StartState state)
        {
            if (HighLogic.LoadedSceneIsFlight)
            {

                if (escapeHatch == null)
                {
                    escapeHatch = new GameObject("EscapeHatch");
                    escapeHatch.tag = "Airlock";
                    escapeHatch.layer = 21;
                    escapeHatch.transform.parent = this.part.transform;
                    escapeHatch.transform.localEulerAngles = new Vector3(0, 0, 0);
                    escapeHatch.transform.localPosition = new Vector3(0, 0, 0);

                    escapeHatch.AddComponent<BoxCollider>();
                    escapeHatchCollider = escapeHatch.GetComponent<BoxCollider>();
                    escapeHatchCollider.size = new Vector3(0.25f, 0.25f, 0.25f);
                    escapeHatchCollider.isTrigger = true;

                    this.part.airlock = escapeHatch.transform;
                    print("[TakeCommand] added escape hatch to " + this.part.name + " (" + this.part.GetInstanceID() + ")");

                    // Disable it for now until we need it
                    escapeHatch.collider.enabled = true;
                }

            }
            base.OnStart(state);
        }
Exemple #8
0
        protected override void OnTriggerExit( Collider other )
        {
            base.OnTriggerExit(other);

            if( !enabled || !ShouldAffect(other) )
                return;

            Rigidbody rigidbody = other.GetComponent<Rigidbody>();

            if( rigidbody == null )
                return;

            if( boxCollider == null )
                boxCollider = GetComponent<BoxCollider>();

            Vector3 position = transform.InverseTransformPoint( other.transform.position );

            if( affectX && Mathf.Abs( position.x * 2 ) >= boxCollider.size.x )
            {
                position.x = -position.x;
            }

            if( affectY && Mathf.Abs( position.y * 2 ) >= boxCollider.size.y )
            {
                position.y = -position.y;
            }

            if( affectZ && Mathf.Abs( position.z * 2 ) >= boxCollider.size.z )
            {
                position.z = -position.z;
            }

            rigidbody.MovePosition( transform.TransformPoint(position) );
        }
 public static float ComputeVolume(UnityEngine.Collider coll)
 {
     if (coll != null)
     {
         UnityEngine.CapsuleCollider collider = coll as UnityEngine.CapsuleCollider;
         if (collider != null)
         {
             UnityEngine.Vector3 lossyScale = collider.transform.lossyScale;
             float num  = collider.height * lossyScale.y;
             float num2 = collider.radius * UnityEngine.Mathf.Max(lossyScale.x, lossyScale.z);
             float num3 = (3.141593f * num2) * num2;
             float num4 = num3 * num;
             float num5 = (num3 * num2) * 1.333333f;
             return(num4 + num5);
         }
         UnityEngine.SphereCollider collider2 = coll as UnityEngine.SphereCollider;
         if (collider2 != null)
         {
             UnityEngine.Vector3 vector2 = collider2.transform.lossyScale;
             float[]             values  = new float[] { vector2.x, vector2.y, vector2.z };
             float num6 = collider2.radius * UnityEngine.Mathf.Max(values);
             return(4.18879f * ((num6 * num6) * num6));
         }
         UnityEngine.BoxCollider collider3 = coll as UnityEngine.BoxCollider;
         if (collider3 != null)
         {
             UnityEngine.Vector3 vector3 = collider3.transform.lossyScale;
             UnityEngine.Vector3 size    = collider3.size;
             return(((size.x * vector3.x) * (size.y * vector3.y)) * (size.z * vector3.z));
         }
         UnityEngine.Debug.LogWarning("Not implemented for " + coll.GetType() + " type!");
     }
     return(0f);
 }
Exemple #10
0
    static int _CreateUnityEngine_BoxCollider(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.BoxCollider.ctor");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.BoxCollider obj = new UnityEngine.BoxCollider();
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.BoxCollider.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int constructor(IntPtr l)
 {
     UnityEngine.BoxCollider o;
     o = new UnityEngine.BoxCollider();
     pushObject(l, o);
     return(1);
 }
        private void Awake()
        {
            // Create frictionless physmaterial for walls
            var material = new PhysicMaterial("Frictionless");
            material.staticFriction = 0f;
            material.dynamicFriction = 0f;
            material.frictionCombine = PhysicMaterialCombine.Minimum;
            material.bounceCombine = PhysicMaterialCombine.Minimum;
            material.bounciness = 0f;

            var surfaces = new BoxCollider[6];
            for (var i = 0; i < 6; i++)
            {
                var obj = new GameObject();
                obj.transform.SetParent(transform, false);
                var collider = obj.AddComponent<BoxCollider>();
                collider.sharedMaterial = material;
                surfaces[i] = collider;
            }
            var size = thickness / transform.localScale.magnitude;
            var offset = 0.5f + size / 2f;
            // Floor
            surfaces[0].size = new Vector3(1f, size, 1f);
            surfaces[0].transform.localPosition = new Vector3(0f, -offset, 0f);
            surfaces[0].name = "Floor";

            // Ceiling
            surfaces[1].size = new Vector3(1f, size, 1f);
            surfaces[1].transform.localPosition = new Vector3(0f, offset, 0f);
            surfaces[1].name = "Ceiling";

            // Wall Z-
            surfaces[2].size = new Vector3(1f, 1f, size);
            surfaces[2].transform.localPosition = new Vector3(0f, 0f, -offset);
            surfaces[2].name = "Wall Z-";

            // Wall Z+
            surfaces[3].size = new Vector3(1f, 1f, size);
            surfaces[3].transform.localPosition = new Vector3(0f, 0f, offset);
            surfaces[3].name = "Wall Z+";

            // Wall X-
            surfaces[4].size = new Vector3(size, 1f, 1f);
            surfaces[4].transform.localPosition = new Vector3(-offset, 0f, 0f);
            surfaces[4].name = "Wall X-";

            // Wall X+
            surfaces[5].size = new Vector3(size, 1f, 1f);
            surfaces[5].transform.localPosition = new Vector3(offset, 0f, 0f);
            surfaces[5].name = "Wall X+";

            if (useLayer)
            {
                for (int i = 0; i < surfaces.Length; i++)
                {
                    surfaces[i].gameObject.layer = gameObject.layer;
                }
            }
        }
Exemple #13
0
        void Awake()
        {
            kickParticle = GetComponentInChildren<ParticleSystem> ();

            kickAudio = GetComponent<AudioSource> ();
            boxCollider = GetComponent<BoxCollider> ();
            //anim = GetComponent<Animation> ();
        }
        void Start()
        {
            _sprite = GetComponent<UISprite>();
            _button = GetComponent<UIButton>();
            _collider = GetComponent<BoxCollider>();

            Reset();
        }
Exemple #15
0
 public override void OnStart()
 {
     var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
     if (currentGameObject != prevGameObject) {
         boxCollider = currentGameObject.GetComponent<BoxCollider>();
         prevGameObject = currentGameObject;
     }
 }
Exemple #16
0
 static public int set_size(IntPtr l)
 {
     UnityEngine.BoxCollider o = (UnityEngine.BoxCollider)checkSelf(l);
     UnityEngine.Vector3     v;
     checkType(l, 2, out v);
     o.size = v;
     return(0);
 }
Exemple #17
0
 public void CreateBox()
 {
     Box = gameObject.AddComponent<BoxCollider>();
     var x = (ToneGrid[0, 0].transform.position.x + ToneGrid[Rows - 1, 0].transform.position.x) / 2;
     var y = (ToneGrid[0, 0].transform.position.y + ToneGrid[0, Cols - 1].transform.position.y) / 2;
     Box.size = new Vector3(Rows * 1.3f, Cols * 1.3f, 1);
     Box.center = new Vector3(x, y, -2);
     Box.enabled = true;
 }
Exemple #18
0
        public static void From3DBoxCollider(VLSObstructor _obstructor, BoxCollider _collider)
        {
            pntBuffer[3] = (_collider.size * 0.5f);
            pntBuffer[2] = new Vector2(pntBuffer[3].x, -pntBuffer[3].y);
            pntBuffer[1] = new Vector2(-pntBuffer[3].x, -pntBuffer[3].y);
            pntBuffer[0] = new Vector2(-pntBuffer[3].x, pntBuffer[3].y);

            for (int i = 0; i < 4; i++)
                _obstructor.LocalVertex(10000, pntBuffer[i] + (Vector2)_collider.center);
        }
        public void Awake()
        {
            Manager = GameManagerLocator.Manager;

            gameObject.AddComponent<BoxCollider>();

            TriggerCollider = GetComponent<BoxCollider>();

            TriggerCollider.isTrigger = true;
        }
Exemple #20
0
        protected void baseAwake()
        {
            box = GetComponent<BoxCollider>();
            MeshRenderer mr = GetComponentInChildren<MeshRenderer>();
            meshObj = mr.transform;
            mat = mr.material;

            enabledPos = meshObj.transform.position;
            disabledPos = enabledPos;
            disabledPos.y -= .015f;
        }
        protected virtual void Start()
        {
            // Make sure the Tagalong object has a BoxCollider.
            tagalongCollider = GetComponent<BoxCollider>();

            // Get the Interpolator component and set some default parameters for
            // it. These parameters can be adjusted in Unity's Inspector as well.
            interpolator = gameObject.GetComponent<Interpolator>();
            interpolator.SmoothLerpToTarget = SmoothMotion;
            interpolator.SmoothPositionLerpRatio = SmoothingFactor;
        }
 static public int get_size(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         pushValue(l, self.size);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static AABBox FromCollider(BoxCollider c, bool local = false)
 {
     if(local)
     {
         return new AABBox(c.center, c.size);
     }
     else
     {
         return new AABBox(c.bounds);
     }
 }
Exemple #24
0
 //
 private void EnableBoxCollider(UnityEngine.GameObject go, bool enable)
 {
     if (go != null)
     {
         UnityEngine.BoxCollider bc = go.GetComponent <UnityEngine.BoxCollider>();
         if (bc != null)
         {
             bc.enabled = enable;
         }
     }
 }
        private void Init()
        {
            if (_isInit)
                return;

            _sprite = GetComponent<UISprite>();
            _button = GetComponent<UIButton>();
            _collider = GetComponent<BoxCollider>();

            _isInit = true;
        }
Exemple #26
0
        private void Init()
        {
            if (_isInit)
                return;

            _collider = GetComponent<BoxCollider>();
            _sprite = GetComponent<UISprite>();
            _positionStart = transform.localPosition;

            _isInit = true;
        }
        private void CreateCollider()
        {
            rb = this.gameObject.AddComponent<Rigidbody>();
            rb.mass = 100;
            rb.freezeRotation = true;

            bc = this.gameObject.AddComponent<BoxCollider>();
            bc.center = new Vector3(0f, 1f, 0f);
            bc.size = new Vector3(0.25f, 1f, 0.25f);

            this.gameObject.layer = 2;
        }
Exemple #28
0
        void Awake() {
            if(this.parentNode != null)
                return;

            var temp = this.transform.parent.gameObject.GetComponent<WarpBlock>() as WarpBlock;
            if(temp == null)
                return;

            this.parentNode = temp;
            this.warpNode = parentNode.warpNode;
            this.warpNodeCollider = this.warpNode.transform.GetChild(0).GetComponent<BoxCollider>();
        }
Exemple #29
0
        private void Init()
        {
            if (_isInit)
                return;

            _collider = GetComponent<BoxCollider>();
            _sprite = GetComponent<UISprite>();
            _startPosition = transform.position;
            _currentCell = null;

            _isInit = true;
        }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider o;
         o = new UnityEngine.BoxCollider();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #31
0
        void Awake() {
            if(this.parentNode != null)
                return;

            var temp = this.transform.parent.gameObject.GetComponent<GlassBlock>() as GlassBlock;
            if(temp == null)
                return;

            this.parentNode = temp;
            this.parentNode.glassBlock = this.gameObject;
            this.blockCollider = this.transform.GetComponent<BoxCollider>() as BoxCollider;
        }
Exemple #32
0
        public void Init(Func<bool> shouldPauseCb, ITimeProvider time, WeaponConfig weaponConfig, BaseShip owner, Rect levelBounds )
        {
            base.Init( shouldPauseCb, time);
            WeaponConfig = weaponConfig;
            Owner = owner;
            LevelBounds = levelBounds;

            ProjectileCollider = gameObject.As< BoxCollider >();

            if ( ProjectileCollider == null )
                throw new MissingComponentException("Box collider is not present on Projectile");
        }
    public UnityEngine.Vector3 GetStartTouchToWorldPoint()
    {
        if (null == UnityEngine.Camera.main)
        {
            return(UnityEngine.Vector3.zero);
        }
        float skill_blear_radius = 0.5f;

        UnityEngine.Vector3    start_touch_worldpos = UnityEngine.Vector3.zero;
        UnityEngine.Vector3    start_touch_pos      = new UnityEngine.Vector3(startPosition.x, startPosition.y, 0);
        UnityEngine.Ray        ray = UnityEngine.Camera.main.ScreenPointToRay(start_touch_pos);
        UnityEngine.RaycastHit hitInfo;

        SkillController player_skill_ctrl = null;

        if (null != player_skill_ctrl)
        {
            SkillInputData skill_input_data = player_skill_ctrl.GetSkillInputData(SkillTags);
            if (null != skill_input_data)
            {
                skill_blear_radius = skill_input_data.targetChooseRange;
            }
        }
        if (UnityEngine.Physics.Raycast(ray, out hitInfo, 200f, m_TerrainAndCharacterLayer))
        {
            start_touch_worldpos = hitInfo.point;
            UnityEngine.GameObject go = ArkCrossEngine.LogicSystem.PlayerSelf;
            if (null != go)
            {
                UnityEngine.Vector3 srcPos    = go.transform.position;
                UnityEngine.Vector3 targetPos = start_touch_worldpos;
                float length = UnityEngine.Vector3.Distance(srcPos, targetPos);
                UnityEngine.RaycastHit airWallHitInfo = new UnityEngine.RaycastHit();
                int airWallLayermask          = 1 << UnityEngine.LayerMask.NameToLayer("AirWall");
                UnityEngine.Vector3 direction = (targetPos - srcPos).normalized;
                if (UnityEngine.Physics.Raycast(go.transform.position, direction, out airWallHitInfo, length, airWallLayermask))
                {
                    UnityEngine.BoxCollider bc = airWallHitInfo.collider.gameObject.GetComponent <UnityEngine.BoxCollider>();
                    if (null != bc && !bc.isTrigger)
                    {
                        start_touch_worldpos = airWallHitInfo.point;
                    }
                }
            }
            UnityEngine.Collider[] hitObjs = UnityEngine.Physics.OverlapSphere(start_touch_worldpos, skill_blear_radius, m_CharacterLayer);
            if (hitObjs.Length > 0)
            {
                start_touch_worldpos = hitObjs[0].gameObject.transform.position;
            }
        }

        return(start_touch_worldpos);
    }
Exemple #34
0
 static public int get_size(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         pushValue(l, self.size);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.BoxCollider o;
			o=new UnityEngine.BoxCollider();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
        public BoxColliderData(UnityEngine.BoxCollider boxCollider)
        {
            if (boxCollider.transform.lossyScale.x <= 0 || boxCollider.transform.lossyScale.y <= 0 ||
                boxCollider.transform.lossyScale.z <= 0)
            {
                Debug.LogError("scale param is less then zero!");
            }

            float scaleX = Mathf.Abs(boxCollider.transform.lossyScale.x);
            float scaleY = Mathf.Abs(boxCollider.transform.lossyScale.y);
            float scaleZ = Mathf.Abs(boxCollider.transform.lossyScale.z);

            this.layer = boxCollider.gameObject.layer;

            //extents 考虑父节点的影响
            this.x_extents = boxCollider.size.x * scaleX;
            this.y_extents = boxCollider.size.y * scaleY;
            this.z_extents = boxCollider.size.z * scaleZ;

            //world pos
            UnityEngine.Vector3 position = boxCollider.transform.position;
            position += boxCollider.transform.right.normalized * boxCollider.center.x * scaleX;
            position += boxCollider.transform.up.normalized * boxCollider.center.y * scaleY;
            position += boxCollider.transform.forward.normalized * boxCollider.center.z * scaleZ;

            this.position.x = position.x;
            this.position.y = position.y;
            this.position.z = position.z;

            //rotation considered
            this.rotation.x = boxCollider.transform.rotation.x;
            this.rotation.y = boxCollider.transform.rotation.y;
            this.rotation.z = boxCollider.transform.rotation.z;
            this.rotation.w = boxCollider.transform.rotation.w;

#if PHYSX_DEBUG
            UnityEngine.Debug.Log("Box Layer: " + this.layer);
            UnityEngine.Debug.Log("=============Pos================");
            UnityEngine.Debug.Log("Box Position X: " + this.position.x);
            UnityEngine.Debug.Log("Box Position Y: " + this.position.y);
            UnityEngine.Debug.Log("Box Position Z: " + this.position.z);
            UnityEngine.Debug.Log("==============Rot================");
            UnityEngine.Debug.Log("Box Rotation X: " + this.rotation.x);
            UnityEngine.Debug.Log("Box Rotation Y: " + this.rotation.y);
            UnityEngine.Debug.Log("Box Rotation Z: " + this.rotation.z);
            UnityEngine.Debug.Log("Box Rotation W: " + this.rotation.w);
            UnityEngine.Debug.Log("===========Extents=============");
            UnityEngine.Debug.Log("Box X_Extents: " + this.x_extents);
            UnityEngine.Debug.Log("Box Y_Extents: " + this.y_extents);
            UnityEngine.Debug.Log("Box Z_Extents: " + this.z_extents);
#endif
        }
Exemple #37
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.BoxCollider o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.BoxCollider();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 static public int set_size(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         UnityEngine.Vector3     v;
         checkType(l, 2, out v);
         self.size = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider o;
         o=new UnityEngine.BoxCollider();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Exemple #40
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider o;
         o = new UnityEngine.BoxCollider();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.BoxCollider boxCollider = (UnityEngine.BoxCollider)value;
     writer.WriteProperty("center", boxCollider.center);
     writer.WriteProperty("size", boxCollider.size);
     writer.WriteProperty("enabled", boxCollider.enabled);
     writer.WriteProperty("isTrigger", boxCollider.isTrigger);
     writer.WriteProperty("contactOffset", boxCollider.contactOffset);
     writer.WriteProperty("material", boxCollider.material);
     writer.WriteProperty("sharedMaterial", boxCollider.sharedMaterial);
     writer.WriteProperty("tag", boxCollider.tag);
     writer.WriteProperty("name", boxCollider.name);
     writer.WriteProperty("hideFlags", boxCollider.hideFlags);
 }
Exemple #42
0
 static public int set_center(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         UnityEngine.Vector3     v;
         checkType(l, 2, out v);
         self.center = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemple #43
0
        private void Start() {
            if (Water == null) {
                Debug.LogError("Water field is not set, SplashZone disabled", this);
                enabled = false;
                return;
            }

            _collider = GetComponent<BoxCollider>();
            _collider.isTrigger = true;

            if (AutoStart) {
                StartRain();
            }
        }
Exemple #44
0
 static public int set_center(IntPtr l)
 {
     try {
         UnityEngine.BoxCollider self = (UnityEngine.BoxCollider)checkSelf(l);
         UnityEngine.Vector3     v;
         checkType(l, 2, out v);
         self.center = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #45
0
 static void BoxCollider_size(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.BoxCollider _this = (UnityEngine.BoxCollider)vc.csObj;
         var result = _this.size;
         JSApi.setVector3S((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.Vector3     arg0  = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg);
         UnityEngine.BoxCollider _this = (UnityEngine.BoxCollider)vc.csObj;
         _this.size = arg0;
     }
 }
Exemple #46
0
 static int OnKnockBarrier(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         PuppetBehavior          obj  = (PuppetBehavior)ToLua.CheckObject(L, 1, typeof(PuppetBehavior));
         UnityEngine.BoxCollider arg0 = (UnityEngine.BoxCollider)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.BoxCollider));
         obj.OnKnockBarrier(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #47
0
    static int Convert(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Quaternion)))
            {
                UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 1);
                UnityEngine.Matrix4x4  o    = UnGfx.Convert(arg0);
                ToLua.PushValue(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Bounds), typeof(UnityEngine.BoxCollider)))
            {
                UnityEngine.Bounds      arg0 = ToLua.ToBounds(L, 1);
                UnityEngine.BoxCollider arg1 = (UnityEngine.BoxCollider)ToLua.ToObject(L, 2);
                UnGfx.Convert(arg0, ref arg1);
                ToLua.Push(L, arg1);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Matrix4x4), typeof(UnityEngine.Quaternion)))
            {
                UnityEngine.Matrix4x4  arg0 = (UnityEngine.Matrix4x4)ToLua.ToObject(L, 1);
                UnityEngine.Quaternion arg1 = ToLua.ToQuaternion(L, 2);
                UnGfx.Convert(ref arg0, ref arg1);
                ToLua.PushValue(L, arg0);
                ToLua.Push(L, arg1);
                return(2);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Quaternion), typeof(UnityEngine.Matrix4x4)))
            {
                UnityEngine.Quaternion arg0 = ToLua.ToQuaternion(L, 1);
                UnityEngine.Matrix4x4  arg1 = (UnityEngine.Matrix4x4)ToLua.ToObject(L, 2);
                UnGfx.Convert(arg0, ref arg1);
                ToLua.PushValue(L, arg1);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnGfx.Convert"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #48
0
 private UnityEngine.GameObject GetRoadSign()
 {
     for (int i = 0; i < m_RoadSignObject.Count; ++i)
     {
         UnityEngine.GameObject roadSign = m_RoadSignObject[i];
         if (null != roadSign)
         {
             UnityEngine.BoxCollider bc = roadSign.GetComponent <UnityEngine.BoxCollider>();
             if (null != bc && bc.isTrigger && !m_TriggeredSign.Contains(roadSign.name))
             {
                 return(roadSign);
             }
         }
     }
     return(null);
 }
    static int set_size(IntPtr L)
    {
        UnityEngine.BoxCollider obj  = (UnityEngine.BoxCollider)ToLua.ToObject(L, 1);
        UnityEngine.Vector3     arg0 = ToLua.ToVector3(L, 2);

        try
        {
            obj.size = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index size on a nil value" : e.Message));
        }

        return(0);
    }
Exemple #50
0
    override protected void start()
    {
        base.start();

        this.setCollisionDownCallback(downPositions);

        this.facing    = Dir.None;
        this.isShaking = false;

        /* XXX: Add an extra collider so moving the only block beneath another
         * doesn't cause the latter to shake */
        Col topCol = this.gameObject.AddComponent <Col>();

        topCol.size      = new Vec3(0.75f, 0.1f, 0.75f);
        topCol.isTrigger = true;
    }
Exemple #51
0
    //播完销毁,可点
    public void UnLockFinish()
    {
        if (unLockEffect != null)
        {
            NGUITools.Destroy(unLockEffect);
            unLockEffect = null;
        }
        UnityEngine.BoxCollider box = gameObject.GetComponent <UnityEngine.BoxCollider>();
        UIButton button             = gameObject.GetComponent <UIButton>();

        if (box != null && button != null)
        {
            button.isEnabled = true;
            button.enabled   = true;
            box.enabled      = true;
        }
    }
Exemple #52
0
        public virtual void Init(Func<bool> shouldPauseCb, ITimeProvider time, ShipConfig config, ShipModel model, Rect levelBounds)
        {
            base.Init( shouldPauseCb, time );
            Config = config;
            Model = model;
            LevelBounds = levelBounds;
            ShipCollider = gameObject.As< BoxCollider >();

            if ( ShipCollider == null )
                throw new MissingComponentException( "Box collider is not present on Ship" );

            var poolItem = gameObject.As< PrefabPoolItem > ();
            if ( poolItem == null )
                throw new MissingComponentException("PrefabPoolItem is not present on Ship");

            poolItem.Reset = PoolReset;
        }
    static int get_size(IntPtr L)
    {
        UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)ToLua.ToObject(L, 1);
        UnityEngine.Vector3     ret;

        try
        {
            ret = obj.size;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index size on a nil value" : e.Message));
        }

        ToLua.Push(L, ret);
        return(1);
    }
    static int _CreateUnityEngine_BoxCollider(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            UnityEngine.BoxCollider obj = new UnityEngine.BoxCollider();
            ToLua.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.BoxCollider.New");
        }

        return(0);
    }
Exemple #55
0
    static int get_center(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o;
            UnityEngine.Vector3     ret = obj.center;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index center on a nil value" : e.Message));
        }
    }
    static int set_center(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.BoxCollider obj  = (UnityEngine.BoxCollider)o;
            UnityEngine.Vector3     arg0 = ToLua.ToVector3(L, 2);
            obj.center = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value"));
        }
    }
Exemple #57
0
        public void refresh(VoxelProduct product, GameObject gameObject)
        {
            Vector3 offset = Vector3.zero;
            Vector3 size =  new Vector3 (product.max.x - product.min.x, product.max.z - product.min.z, product.max.y - product.min.y);
            offset = size / -2.0f -new Vector3 ( product.min.x, product.min.z,  product.min.y);

            this._mesh.transform.localPosition = offset;

            if (_collider == null) {
                _collider = gameObject.GetComponent <BoxCollider>();
            }

            if (_collider == null) {
                _collider = gameObject.AddComponent <BoxCollider>();
            }
            _collider.size = size + Vector3.one;
        }
    static int get_size(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.BoxCollider obj = (UnityEngine.BoxCollider)o;
            UnityEngine.Vector3     ret = obj.size;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index size on a nil value"));
        }
    }
Exemple #59
0
    static int UpdateWidgetCollider(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                NGUITools.UpdateWidgetCollider(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.BoxCollider2D), typeof(bool)))
            {
                UnityEngine.BoxCollider2D arg0 = (UnityEngine.BoxCollider2D)ToLua.ToObject(L, 1);
                bool arg1 = LuaDLL.lua_toboolean(L, 2);
                NGUITools.UpdateWidgetCollider(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.BoxCollider), typeof(bool)))
            {
                UnityEngine.BoxCollider arg0 = (UnityEngine.BoxCollider)ToLua.ToObject(L, 1);
                bool arg1 = LuaDLL.lua_toboolean(L, 2);
                NGUITools.UpdateWidgetCollider(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(bool)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                bool arg1 = LuaDLL.lua_toboolean(L, 2);
                NGUITools.UpdateWidgetCollider(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NGUITools.UpdateWidgetCollider"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #60
0
        void Awake()
        {
            // Get the Camera component
            m_camera = GetComponent<Camera>();
            if (m_camera == null)
            {
                Debug.LogError("You need to dray this script to a camera!");
                return;
            }

            // Attach a BoxCollider to this camera
            // In order to receive mouse events
            if (pickerCollider == null)
            {
                pickerCollider = gameObject.AddComponent<BoxCollider>();
                // Make sure the collider is in the camera's frustum
                pickerCollider.center = Vector3.zero;
                pickerCollider.center += m_camera.transform.worldToLocalMatrix.MultiplyVector(m_camera.transform.forward) * (m_camera.nearClipPlane + 0.2f);
                pickerCollider.size = new Vector3(Screen.width, Screen.height, 0.1f);
            }
        }