Пример #1
0
        public static LayerMask LayerMaskField(string label, LayerMask layerMask)
        {
            List<string> layers = new List<string>();
            List<int> layerNumbers = new List<int>();

            for (int i = 0; i < 32; i++) {
                string layerName = LayerMask.LayerToName(i);
                if (layerName != "") {
                    layers.Add(layerName);
                    layerNumbers.Add(i);
                }
            }
            int maskWithoutEmpty = 0;
            for (int i = 0; i < layerNumbers.Count; i++) {
                if (((1 << layerNumbers[i]) & layerMask.value) > 0)
                    maskWithoutEmpty |= (1 << i);
            }
            maskWithoutEmpty = EditorGUILayout.MaskField(label, maskWithoutEmpty, layers.ToArray());
            int mask = 0;
            for (int i = 0; i < layerNumbers.Count; i++) {
                if ((maskWithoutEmpty & (1 << i)) > 0)
                    mask |= (1 << layerNumbers[i]);
            }
            layerMask.value = mask;
            return layerMask;
        }
Пример #2
0
        public void init(float angle)
        {
            colliders = entity == Entities.player ? player_owner_collide_layers : enemy_owner_collide_layers;

            this.angle = angle;

            RaycastHit2D hit = Physics2D.Raycast(transform.position, new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)),
                                                 MAX_DISTANCE, colliders);
            float dist = hit.transform == null ? MAX_DISTANCE : hit.distance;
            float num_particles = dist / particle_seperation;

            Vector3 pos = transform.position;
            pos.z = -20;
            GameObject railgun_particle = (GameObject)Resources.Load("particles/railgun_lightning");

            for (int n = 0; n < num_particles; ++n)
            {
                pos.x += Mathf.Cos(angle) * particle_seperation;
                pos.y += Mathf.Sin(angle) * particle_seperation;
                GameObject obj = (GameObject)Instantiate(railgun_particle, pos, Quaternion.identity);

                //check if any colliders are overlapping with a circle raycast
                Collider2D col = Physics2D.OverlapCircle(pos, particle_seperation, colliders);
                if (col)
                {
                    //if the gameobject has a health component, deal damage to them
                    GenericHealth health = col.gameObject.GetComponent<GenericHealth>();
                    if (health != null) health.take_damage(damage);
                }
            }
        }
Пример #3
0
        /** Displays a LayerMask field.
         * \param label Label to display
         * \param showSpecial Use the Nothing and Everything selections
         * \param selected Current LayerMask
         * \note Unity 3.5 and up will use the EditorGUILayout.MaskField instead of a custom written one.
         */
        public static LayerMask LayerMaskField(string label, LayerMask selected)
        {
            if (layers == null || (System.DateTime.UtcNow.Ticks - lastUpdateTick > 10000000L && Event.current.type == EventType.Layout)) {
                lastUpdateTick = System.DateTime.UtcNow.Ticks;
                if (layers == null) {
                    layers = new List<string>();
                    layerNames = new string[4];
                } else {
                    layers.Clear ();
                }

                int emptyLayers = 0;
                for (int i=0;i<32;i++) {
                    string layerName = LayerMask.LayerToName (i);

                    if (layerName != "") {

                        for (;emptyLayers>0;emptyLayers--) layers.Add ("Layer "+(i-emptyLayers));
                        layers.Add (layerName);
                    } else {
                        emptyLayers++;
                    }
                }

                if (layerNames.Length != layers.Count) {
                    layerNames = new string[layers.Count];
                }
                for (int i=0;i<layerNames.Length;i++) layerNames[i] = layers[i];
            }

            selected.value =  EditorGUILayout.MaskField (label,selected.value,layerNames);

            return selected;
        }
Пример #4
0
 // Cast a circle with the desired distance. Check each collider hit to see if it is within the field of view. Set objectFound
 // to the object that is most directly in front of the agent
 public static GameObject WithinSight2D(Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, LayerMask objectLayerMask, Vector3 targetOffset, LayerMask ignoreLayerMask)
 {
     GameObject objectFound = null;
     var hitColliders = Physics2D.OverlapCircleAll(transform.position, viewDistance, objectLayerMask);
     if (hitColliders != null)
     {
         float minAngle = Mathf.Infinity;
         for (int i = 0; i < hitColliders.Length; ++i)
         {
             float angle;
             GameObject obj;
             // Call the 2D WithinSight function to determine if this specific object is within sight
             if ((obj = WithinSight(transform, positionOffset, fieldOfViewAngle, viewDistance, hitColliders[i].gameObject, targetOffset, true, out angle, ignoreLayerMask)) != null)
             {
                 // This object is within sight. Set it to the objectFound GameObject if the angle is less than any of the other objects
                 if (angle < minAngle)
                 {
                     minAngle = angle;
                     objectFound = obj;
                 }
             }
         }
     }
     return objectFound;
 }
Пример #5
0
        private void Awake()
        {
            LayerOn = LayerMask.NameToLayer (KickStarter.settingsManager.hotspotLayer);
            LayerOff = LayerMask.NameToLayer (KickStarter.settingsManager.deactivatedLayer);

            _Awake ();
        }
Пример #6
0
		private void Awake ()
		{
			SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager;
			LayerHotspot = LayerMask.NameToLayer (settingsManager.hotspotLayer);
			LayerOff = LayerMask.NameToLayer (settingsManager.deactivatedLayer);
			
			if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>())
			{
				actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>();
			}
			
			// If asset-based, download actions
			if (source == ActionListSource.AssetFile)
			{
				actions.Clear ();
				if (assetFile != null && assetFile.actions.Count > 0)
				{
					foreach (AC.Action action in assetFile.actions)
					{
						actions.Add (action);
					}
					useParameters = assetFile.useParameters;
					parameters = assetFile.parameters;
				}
			}
			
			if (useParameters)
			{
				// Reset all parameters
				foreach (ActionParameter _parameter in parameters)
				{
					_parameter.Reset ();
				}
			}
		}
Пример #7
0
 public override void Reset () {
     explosionPoint = new ConcreteVector3Var();
     explosionPosition = new ConcreteGameObjectVar(this.self);
     explosionForce = new ConcreteFloatVar();
     explosionRadius = new ConcreteFloatVar();
     layers = -1;
 }
Пример #8
0
        public void init(float angle, float damage, float max_distance, LayerMask colliders)
        {
            this.angle = angle;
            this.damage = damage;
            this.max_distance = max_distance;
            this.colliders = colliders;

            RaycastHit2D hit = Physics2D.Raycast(transform.position, new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)),
                                                 max_distance, colliders);
            float dist = hit.transform == null ? max_distance : hit.distance;
            float num_particles = dist / PARTICLE_SEP;

            Vector3 pos = transform.position;
            pos.z = -20;
            GameObject railgun_particle = (GameObject)Resources.Load("particles/railgun_lightning");

            for (int n = 0; n < num_particles; ++n)
            {
                pos.x += Mathf.Cos(angle) * PARTICLE_SEP;
                pos.y += Mathf.Sin(angle) * PARTICLE_SEP;
                GameObject obj = (GameObject)Instantiate(railgun_particle, pos, Quaternion.identity);

                //check if any colliders are overlapping with a circle raycast
                Collider2D col = Physics2D.OverlapCircle(pos, PARTICLE_SEP, colliders);
                if (col)
                {
                    //if the gameobject has a health component, deal damage to them
                    GenericHealth health = col.gameObject.GetComponent<GenericHealth>();
                    if (health != null) health.take_damage(damage);
                }
            }
        }
Пример #9
0
 bool CheckGround(Transform groundCheck, LayerMask whatIsGround, float groundedRadius)
 {
     if(groundCheck!=null)
         return Physics2D.OverlapCircle (groundCheck.position, groundedRadius, whatIsGround);
     else
         return true;
 }
        static LayerMask LayerMaskField(string label, LayerMask layerMask)
        {
            var layers = UnityEditorInternal.InternalEditorUtility.layers;

            _layerNumbers.Clear ();

            for (int i = 0; i < layers.Length; i++) {
                _layerNumbers.Add (LayerMask.NameToLayer (layers[i]));
            }

            var maskWithoutEmpty = 0;
            var count = _layerNumbers.Count;
            for (var i = 0; i < count; i++) {
                if (((1 << _layerNumbers[i]) & layerMask.value) != 0) {
                    maskWithoutEmpty |= (1 << i);
                }
            }

            maskWithoutEmpty = EditorGUILayout.MaskField (label, maskWithoutEmpty, layers);

            var mask = 0;
            for (int i = 0; i < count; i++) {
                if ((maskWithoutEmpty & (1 << i)) != 0) {
                    mask |= (1 << _layerNumbers[i]);
                }
            }
            layerMask.value = mask;

            return layerMask;
        }
Пример #11
0
        public Inspector()
        {
            if( instance != null )
            {
                Debug.LogError( "Creating extra instance of singleton Inspector" );
                return;
            }

            instance = this;
            blockingLayers = LayerMask.NameToLayer( "Default" );

            meshReference = null;
            showNetwork = true;
            showNode = true;
            showConnection = true;
            networkTags = false;
            nodeTags = false;
            connectionTags = false;
            bidirectionalConnect = false;
            blockingLayers = -1;

            connectionWidthNetwork = 1.0f;
            connectionWidthNode = 1.0f;

            instance = this;
        }
Пример #12
0
 static public int constructor(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.LayerMask o;
         o = new UnityEngine.LayerMask();
         pushValue(l, true);
         pushValue(l, o);
         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
 }
		public static LayerMask LayerMaskField(string label, LayerMask layerMask)
		{
			var layers = InternalEditorUtility.layers;

			layerNumbers.Clear();

			for(int i = 0; i < layers.Length; i++)
				layerNumbers.Add(LayerMask.NameToLayer(layers[i]));

			int maskWithoutEmpty = 0;
			for(int i = 0; i < layerNumbers.Count; i++)
			{
				if(((1 << layerNumbers[i]) & layerMask.value) > 0)
					maskWithoutEmpty |= (1 << i);
			}

			maskWithoutEmpty = UnityEditor.EditorGUILayout.MaskField(label, maskWithoutEmpty, layers);

			int mask = 0;
			for(int i = 0; i < layerNumbers.Count; i++)
			{
				if((maskWithoutEmpty & (1 << i)) > 0)
					mask |= (1 << layerNumbers[i]);
			}
			layerMask.value = mask;

			return layerMask;
		}
Пример #14
0
 public static bool checkType(IntPtr l, int p, out LayerMask lm)
 {
     int v;
     checkType(l, p, out v);
     lm = v;
     return true;
 }
Пример #15
0
		public override void Start()
		{
			base.Start();
			floorLayerMask = 1 << UniRPGGlobal.DB.floorLayerMask;

			if (UniRPGGlobal.Instance.state != UniRPGGlobal.State.InMainMenu)
			{
				if (clickMarkerPrefab)
				{
					clickMarker = (GameObject)GameObject.Instantiate(clickMarkerPrefab);
					clickMarker.SetActive(false);
				}

				selectionRing = new GameObject[UniRPGGlobal.DB.selectionRingPrefabs.Length];
				for (int i = 0; i < UniRPGGlobal.DB.selectionRingPrefabs.Length; i++)
				{
					if (UniRPGGlobal.DB.selectionRingPrefabs[i])
					{
						selectionRing[i] = (GameObject)GameObject.Instantiate(UniRPGGlobal.DB.selectionRingPrefabs[i]);
						selectionRing[i].AddComponent<SimpleFollow>();
						selectionRing[i].AddComponent<SimpleAutoHide>();
						selectionRing[i].SetActive(false);
					}
					else selectionRing[i] = null;
				}
			}
		}
Пример #16
0
        /// <summary>
        /// Simple test for an object being visible. We test the field of view and the view distance.
        /// Future version will check for objects blocking the view.
        /// 
        /// This version allows us to search for any object on a specific layer. If requested, we will
        /// return the closest one.
        /// </summary>
        /// <param name="rPosition"></param>
        /// <param name="rForward"></param>
        /// <param name="rFOV"></param>
        /// <param name="rDistance"></param>
        /// <param name="rTargetLayerMask"></param>
        /// <param name="rClosest"></param>
        /// <returns></returns>
        public static GameObject IsObjectVisible(Vector3 rPosition, Vector3 rForward, float rFOV, float rDistance, LayerMask rTargetLayerMask, bool rClosest)
        {
            GameObject lClosestObject = null;

            // Grab all the object in a sphere around the center
            Collider[] lColliders = UnityEngine.Physics.OverlapSphere(rPosition, rDistance, rTargetLayerMask);
            if (lColliders != null)
            {
                // If we don't carea bout the closest one, just return the first one
                if (!rClosest) { return lColliders[0].gameObject; }

                // Test each of the objects to find the closest (with in the field of view
                float lClosestDistance = float.MaxValue;
                for (int i = 0; i < lColliders.Length; ++i)
                {
                    GameObject lTargetObject = lColliders[i].gameObject;
                    if (lTargetObject != null)
                    {
                        // Test each object to ensure that it
                        float lDistance = IsObjectVisible(rPosition, rForward, rFOV, rDistance, lTargetObject.transform);
                        if (lDistance > 0f && lDistance < lClosestDistance)
                        {
                            lClosestDistance = lDistance;
                            lClosestObject = lTargetObject;
                        }
                    }
                }
            }

            return lClosestObject;
        }
        public static GridNode2D[,] BuildGrid(Rect bounds, float nodeSize, LayerMask layerMask, Dictionary<string, int> tagPenalties)
        {
            float xDistance = bounds.xMax - bounds.xMin;
            float yDistance = bounds.yMax - bounds.yMin;
            int gridX = (int) Mathf.Ceil(xDistance / nodeSize);
            int gridY = (int) Mathf.Ceil(yDistance / nodeSize);

            GridNode2D[,] returnVal = new GridNode2D[gridX, gridY];
            int nodeY = 0;

            for (float y = bounds.yMax; y > bounds.yMin; y -= nodeSize) {
                // trace ray from left to right
                float distanceSet = 0;
                int nodeX = 0;
                while (distanceSet <= xDistance) {
                    float distanceLeft = xDistance - distanceSet;
                    Vector2 origin = new Vector2(bounds.xMin + distanceSet, y);
                    RaycastHit2D rayCast = Physics2D.Raycast(origin, Vector2.right, distanceLeft, layerMask);

                    // If it hits something then mark each entry up to that point as passable
                    float hitPoint = Mathf.Floor(rayCast.distance / nodeSize) * nodeSize;
                    if (rayCast.collider == null) {
                        hitPoint = distanceLeft;
                    }

                    Debug.DrawRay(origin, Vector2.right * hitPoint);

                    for (float i = 0; i < hitPoint; i += nodeSize) {
                        returnVal[nodeX, nodeY] = new GridNode2D(new Point2D(origin.x + i, y)) {
                            Passable = true,
                        };
                        nodeX++;
                    }

                    // Mark the point it hit as impassable
                    distanceSet += (hitPoint + nodeSize);
                    if (distanceSet < xDistance && rayCast.collider != null) {
                        nodeX++;
                        bool passable = false;
                        int penalty = 0;

                        if (tagPenalties.ContainsKey(rayCast.collider.tag)) {
                            penalty = tagPenalties[rayCast.collider.tag];
                            passable = true;
                        }

                        returnVal[nodeX, nodeY] = new GridNode2D(new Point2D(bounds.xMin + distanceSet, y)) {
                            Passable = passable,
                            Penalty = penalty
                        };
                    }
                    // Repeat until there is no distance to go
                }

                nodeY++;
            }

            return returnVal;
        }
Пример #18
0
        public void init(float angle, int decay_in_ms = 4000)
        {
            colliders = entity == Entities.player ? player_owner_collide_layers : enemy_owner_collide_layers;

            add_logic<BulletLogicDecay>().init(decay_in_ms);

            this.angle = angle;
        }
Пример #19
0
 public override void Reset () {
     startPoint = new ConcreteGameObjectVar(this.self);
     endPoint = new ConcreteGameObjectVar(this.self);
     layers = 0;
     storeGameObject = new ConcreteGameObjectVar();
     storeFraction = new ConcreteFloatVar();
     storePoint = new ConcreteVector3Var();
 }
Пример #20
0
 public override void Reset () {
     base.Reset ();
     
     distance = Mathf.Infinity;
     layerMask = -1;
     storeGameObject = new ConcreteGameObjectVar();
     storePoint = new ConcreteVector3Var();
 }
Пример #21
0
 public override void OnReset()
 {
     originGameObject = null;
     originPosition = Vector3.zero;
     direction = Vector3.zero;
     distance = -1;
     layerMask = -1;
     space = Space.Self;
 }
Пример #22
0
        public void init(float angle, int decay_in_ms = 4000)
        {
            colliders = entity == Entities.player ? player_owner_collide_layers : enemy_owner_collide_layers;

            add_logic<BulletLogicDecay>().init(decay_in_ms);

            this.angle = angle;
            transform.localEulerAngles = new Vector3(0, 0, UnityEngine.Random.Range(0, 360));
        }
Пример #23
0
 public override void Reset () {
     origin = new ConcreteGameObjectVar(this.self);
     direction = new ConcreteGameObjectVar(this.self);
     distance = new ConcreteFloatVar();
     layers = 0;
     storeGameObject = new ConcreteGameObjectVar();
     storeDistance = new ConcreteFloatVar();
     storePoint = new ConcreteVector3Var();
 }
Пример #24
0
 public bool UpdateColliders(Vector2 topLeft, Vector2 bottomRight, LayerMask layerMask)
 {
     if (_updateOnFrame == Time.frameCount)
     {
         return collidersChangedOnLastUpdate;
     }
     collidersChangedOnLastUpdate = InnerUpdateColliders(topLeft, bottomRight, layerMask);
     return collidersChangedOnLastUpdate;
 }
Пример #25
0
        public static void LoadEditorPrefs()
        {
#if UNITY_EDITOR
            DEBUG_MODE = (VLSDebugMode)UnityEditor.EditorPrefs.GetInt("VLS_DEBUG_MODE", (int)VLSDebugMode.Geometry);
            DEFAULT_LIGHT_LAYER = UnityEditor.EditorPrefs.GetInt("DEFAULT_LIGHT_LAYER", 0);
            DEFAULT_LIGHT_SCALE = UnityEditor.EditorPrefs.GetFloat("DEFAULT_LIGHT_SCALE", 10);
            DEFAULT_LIGHT_SHADOW_LAYER = UnityEditor.EditorPrefs.GetInt("DEFAULT_LIGHT_SHADOW_LAYER", -1);
#endif
        }
Пример #26
0
        /** Check if this GameObject's renderer or any child renderer that matches `mask`
         * is currently visible on screen.
         */
        public static bool IsAnyPartVisible(this GameObject go, LayerMask mask)
        {
            var renderers =
                from r in go.GetComponentsInChildren<Renderer> ()
                    where (mask & r.gameObject.layer) != 0 && r.isVisible
                    select r;

            return renderers.Count () > 0;
        }
Пример #27
0
 public TeleportBuilder(GameObject gameObject, InputActions input, string targetVariable, float timeout, LayerMask obstacles, float distance)
 {
     this.gameObject = gameObject;
       this.input = input;
       this.targetVariable = targetVariable;
       this.timeout = timeout;
       this.obstacles = obstacles;
       this.distance = distance;
 }
Пример #28
0
 public override void Reset () {
     explosionPoint = new ConcreteVector3Var();
     explosionPosition = new ConcreteGameObjectVar(this.self);
     explosionForce = new ConcreteFloatVar();
     explosionRadius = new ConcreteFloatVar();
     upwardsModifier = new ConcreteFloatVar();
     mode = ForceMode.Force;
     layers = -1;
 }
Пример #29
0
		private void Awake ()
		{
			GetSettingsManager ();
			LayerOn = LayerMask.NameToLayer (settingsManager.hotspotLayer);
			LayerOff = LayerMask.NameToLayer (settingsManager.deactivatedLayer);

			navigationManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <NavigationManager>();

			_Awake ();
		}
Пример #30
0
    static public int set_value(IntPtr l)
    {
        UnityEngine.LayerMask o = (UnityEngine.LayerMask)checkSelf(l);
        int v;

        checkType(l, 2, out v);
        o.value = v;
        setBack(l, o);
        return(0);
    }
Пример #31
0
		public override RaycastHit2D CastRay(Vector2 relativeRayOrigin, Vector2 direction, float rayLength, LayerMask layers, LayerMask blockingLayers = default(LayerMask)) {
  		RaycastHit2D hit = base.CastRay(relativeRayOrigin, direction, rayLength, layers, blockingLayers);
  		if (hit.collider && hit.GameObject().IsInLayerMask(_oneWayGeometryLayer)) {
  			if (this.Constraints.FallThroughOneWayPlatforms || Mathf.Sign(direction.y) != -1) {
          // return empty hit instead of actual hit if we're allowed to go through the one way platform
  				return new RaycastHit2D();
  			}
  		}
  		return hit;
  	}
Пример #32
0
        void Awake()
        {
            Physics.IgnoreLayerCollision(0, 8, true);

            whatIsGround = 1<<0 | 1 << 2;
            rigidBody = GetComponent<Rigidbody2D>();
            GroundCheck = transform.Find("GroundCheck");
            Anim = GetComponent<Animator>();
            curCamera.cullingMask = 1 | 1<<2;
        }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.LayerMask o;
         o = new UnityEngine.LayerMask();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #34
0
 void LayerMaskField_ValueChanged(object sender, EventArgs e)
 {
     if (Owner.IgnoreChanges)
     {
         return;
     }
     Value = new UnityEngine.LayerMask()
     {
         value = _Field.Layers
     };
     Owner.SetDirty();
 }
    public void In(
        [FriendlyName("Existing Masks", "The existing layer masks.")]
        UnityEngine.LayerMask A,

        [FriendlyName("Masks to Remove", "The masks you want removed from the Existing Mask.")]
        UnityEngine.LayerMask B,

        [FriendlyName("Result", "The LayerMask result of the operation.")]
        out UnityEngine.LayerMask LayerMask
        )
    {
        LayerMask = A & ~B;
    }
    public void In(
        [FriendlyName("A", "The first layer mask.")]
        UnityEngine.LayerMask A,

        [FriendlyName("B", "The second layer mask.")]
        UnityEngine.LayerMask B,

        [FriendlyName("Result", "The LayerMask result of the operation.")]
        out UnityEngine.LayerMask LayerMask
        )
    {
        LayerMask = A | B;
    }
Пример #37
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.LayerMask o;
         o = new UnityEngine.LayerMask();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #38
0
        void OnServerInitialized()
        {
            serverInitialized = true;
            originalWallhack  = new UnityEngine.GameObject("Anti Wallhack");
            originalWallhack.AddComponent <MeshCollider>();
            originalWallhack.AddComponent <TriggerBase>();
            originalWallhack.gameObject.layer = UnityEngine.LayerMask.NameToLayer("Trigger");
            var newlayermask = new UnityEngine.LayerMask();

            newlayermask.value = 133120;
            originalWallhack.GetComponent <TriggerBase>().interestLayers = newlayermask;
            RefreshAllWalls();
            RefreshPlayers();
        }
Пример #39
0
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.LayerMask layerMask = new UnityEngine.LayerMask();
     foreach (string property in reader.Properties)
     {
         switch (property)
         {
         case "value":
             layerMask.value = reader.ReadProperty <System.Int32> ();
             break;
         }
     }
     return(layerMask);
 }
Пример #40
0
 static public int op_Implicit__LayerMask__Int32_s(IntPtr l)
 {
     try {
         System.Int32 a1;
         checkType(l, 1, out a1);
         UnityEngine.LayerMask ret = a1;
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #41
0
// fields

// properties
    static void LayerMask_value(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.LayerMask _this = (UnityEngine.LayerMask)vc.csObj;
            var result = _this.value;
            JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
        }
        else
        {
            System.Int32          arg0  = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
            UnityEngine.LayerMask _this = (UnityEngine.LayerMask)vc.csObj;
            _this.value = arg0;
            JSMgr.changeJSObj(vc.jsObjID, _this);
        }
    }
 static void CollisionModule_collidesWith(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem.CollisionModule _this = (UnityEngine.ParticleSystem.CollisionModule)vc.csObj;
         var result = _this.collidesWith;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.LayerMask arg0 = (UnityEngine.LayerMask)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem.CollisionModule _this = (UnityEngine.ParticleSystem.CollisionModule)vc.csObj;
         _this.collidesWith = arg0;
         JSMgr.changeJSObj(vc.jsObjID, _this);
     }
 }
Пример #43
0
    static int set_blockingMask(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj  = (UnityEngine.UI.GraphicRaycaster)o;
            UnityEngine.LayerMask           arg0 = ToLua.ToLayerMask(L, 2);
            obj.blockingMask = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index blockingMask on a nil value"));
        }
    }
Пример #44
0
    static int get_groundLayer(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DummyBehavior         obj = (DummyBehavior)o;
            UnityEngine.LayerMask ret = obj.groundLayer;
            ToLua.PushLayerMask(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index groundLayer on a nil value" : e.Message));
        }
    }
Пример #45
0
            public void SetInfo(ElevatorInfo info)
            {
                this.info = info;
                var cwaypoints = Interface.CallHook("GetWaypointsList", this.info.WaypointsName);

                if (cwaypoints == null)
                {
                    Debug.Log(string.Format("{0} was destroyed, informations are invalid. Did you set waypoints? or a PrefabName?", info.Name));
                    GameObject.Destroy(this);
                    return;
                }
                this.waypoints = new List <WaypointInfo>();
                foreach (var cwaypoint in (List <object>)cwaypoints)
                {
                    foreach (KeyValuePair <Vector3, float> pair in (Dictionary <Vector3, float>)cwaypoint)
                    {
                        this.waypoints.Add(new WaypointInfo(pair.Key, pair.Value));
                    }
                }
                if (this.waypoints.Count < 2)
                {
                    Debug.Log(string.Format("{0} waypoints were detected for {1}. Needs at least 2 waypoints. Destroying.", this.waypoints.Count.ToString(), info.Name));
                    GameObject.Destroy(this);
                    return;
                }
                this.rotation = new UnityEngine.Quaternion(Convert.ToSingle(info.rx), Convert.ToSingle(info.ry), Convert.ToSingle(info.rz), Convert.ToSingle(info.rw));
                this.block    = CreateBuildingBlock(this.info.PrefabName, this.waypoints[0].GetPosition(), this.rotation, Convert.ToInt32(this.info.Grade));
                if (this.block == null)
                {
                    Debug.Log(string.Format("Something went wrong, couldn't create the BuildingBlock for {0}", info.Name));
                    GameObject.Destroy(this);
                    return;
                }
                protectedBlock.Add(this.block.GetComponent <BaseCombatEntity>());
                trigger = block.GetComponentInChildren <MeshCollider>().gameObject.AddComponent <TriggerBase>();
                trigger.gameObject.name = "Elevator";
                var newlayermask = new UnityEngine.LayerMask();

                newlayermask.value       = 133120;
                trigger.interestLayers   = newlayermask;
                trigger.gameObject.layer = UnityEngine.LayerMask.NameToLayer("Trigger");
                spawnedElevators.Add(this);
            }
Пример #46
0
 static public int get_value(IntPtr l)
 {
     UnityEngine.LayerMask o = (UnityEngine.LayerMask)checkSelf(l);
     pushValue(l, o.value);
     return(1);
 }
Пример #47
0
 static bool LayerMask_op_Implicit__LayerMask_to_Int32(JSVCall vc, int argc)
 {
     UnityEngine.LayerMask arg0 = (UnityEngine.LayerMask)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
     JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)((System.Int32)arg0));
     return(true);
 }
Пример #48
0
 public abstract void Attack(UnitTable.UnitStatus _UnitStatus, float _Talent, UnityEngine.Vector3 _Direction, UnityEngine.LayerMask _AttackerLayer);
Пример #49
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.LayerMask layerMask = (UnityEngine.LayerMask)value;
     writer.WriteProperty("value", layerMask.value);
 }