public static UnityEngine.LayerMask GetLayerMask(SerializationInfo info)
        {
            var m = new UnityEngine.LayerMask();

            m.value = info.GetInt32("mask");
            return(m);
        }
Beispiel #2
0
        public string GenerateClass(string className)
        {
            var classBuilder = new ClassDeclaration.Builder(className)
                               .SetAccessModifer(AccessModifier.PUBLIC);

            for (int layerIndex = 0; layerIndex < MAX_NUM_LAYERS; layerIndex++)
            {
                string layerName = UnityLayerMask.LayerToName(layerIndex);

                if (0 == layerName.Length)
                {
                    continue;
                }

                string layerPropertyName = PropertyUtil.CleanName(layerName);
                var    property          = new PropertyDeclaration.Builder(C.INT_TYPE, layerPropertyName)
                                           .SetAccessModifier(AccessModifier.PUBLIC)
                                           .SetValue(layerIndex.ToString())
                                           .IsStatic(true)
                                           .Build();

                classBuilder.AddProperty(property);
            }

            return(CSharpGenerator.GenerateClass(classBuilder.Build()));
        }
        public object Read(object value, ProtoReader source)
        {
            UnityEngine.LayerMask data = (UnityEngine.LayerMask)value;

            int fieldNumber = 0;

            SubItemToken token = ProtoReader.StartSubItem(source);

            while ((fieldNumber = source.ReadFieldHeader()) != 0)
            {
                switch (fieldNumber)
                {
                case 1:
                    data.value = source.ReadInt32();
                    break;

                default:
                    source.SkipField();
                    break;
                }
            }

            ProtoReader.EndSubItem(token, source);

            return(data);
        }
Beispiel #4
0
        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new UnityEngine.LayerMask();

            ins = (UnityEngine.LayerMask)o;
            return(ins);
        }
        public static void AddValue(SerializationInfo info, UnityEngine.LayerMask value)
        {
            if (info == null)
            {
                throw new System.ArgumentNullException("info");
            }

            info.AddValue("mask", value.value);
        }
Beispiel #6
0
        public static void StructTest3()
        {
            UnityEngine.LayerMask maskValue     = StaticMaskValue;
            UnityEngine.LayerMask maskFuncValue = GetStaticMaskValue();


            var cls = new MyClass();

            UnityEngine.LayerMask maskLinqFuncValue = cls.GetMaskValue(123);
        }
Beispiel #7
0
        public Entity AddCollision(UnityEngine.Collider newOther, UnityEngine.LayerMask newTankMask, float newExplosionRadius, float newMaxDamage, float newExplosionForce)
        {
            var component = CreateComponent <CollisionComponent>(ComponentIds.Collision);

            component.other           = newOther;
            component.tankMask        = newTankMask;
            component.explosionRadius = newExplosionRadius;
            component.maxDamage       = newMaxDamage;
            component.explosionForce  = newExplosionForce;
            return(AddComponent(ComponentIds.Collision, component));
        }
        public void Write(object value, ProtoWriter dest)
        {
            UnityEngine.LayerMask data = (UnityEngine.LayerMask)value;

            SubItemToken token = ProtoWriter.StartSubItem(value, dest);

            ProtoWriter.WriteFieldHeader(1, WireType.Variant, dest);
            ProtoWriter.WriteInt32(data.value, dest);



            ProtoWriter.EndSubItem(token, dest);
        }
Beispiel #9
0
        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.LayerMask instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.LayerMask[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
        static StackObject *op_Implicit_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.LayerMask mask = (UnityEngine.LayerMask) typeof(UnityEngine.LayerMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = (System.Int32)mask;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
        static StackObject *set_eventMask_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.LayerMask @value = (UnityEngine.LayerMask) typeof(UnityEngine.LayerMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.EventSystems.PhysicsRaycaster instance_of_this_method = (UnityEngine.EventSystems.PhysicsRaycaster) typeof(UnityEngine.EventSystems.PhysicsRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.eventMask = value;

            return(__ret);
        }
Beispiel #12
0
        static StackObject *get_value_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.LayerMask instance_of_this_method = (UnityEngine.LayerMask) typeof(UnityEngine.LayerMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Beispiel #13
0
        static StackObject *SetLayerMask_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.LayerMask layerMask = (UnityEngine.LayerMask) typeof(UnityEngine.LayerMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.ContactFilter2D instance_of_this_method;
            instance_of_this_method = (UnityEngine.ContactFilter2D) typeof(UnityEngine.ContactFilter2D).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.SetLayerMask(layerMask);

            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            return(__ret);
        }
        static StackObject *set_value_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.LayerMask instance_of_this_method = (UnityEngine.LayerMask) typeof(UnityEngine.LayerMask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.value = value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(__ret);
        }
Beispiel #15
0
 public static bool Contains(this UnityEngine.LayerMask mask, UnityEngine.GameObject gameObject)
 {
     return((mask.value & (1 << gameObject.layer)) > 0);
 }
    public void ReplacePlayerProperties(float newMoveSpeed, float newRotSpeed, float newGravity, UnityEngine.LayerMask newIgnoreGroundCheckLayer, PlayerState newPlayerState)
    {
        var index     = GameComponentsLookup.PlayerProperties;
        var component = CreateComponent <PlayerPropertiesComponent>(index);

        component.moveSpeed = newMoveSpeed;
        component.rotSpeed  = newRotSpeed;
        component.gravity   = newGravity;
        component.ignoreGroundCheckLayer = newIgnoreGroundCheckLayer;
        component.playerState            = newPlayerState;
        ReplaceComponent(index, component);
    }
Beispiel #17
0
 public static bool LayerIsInLayerMask(int layer, UnityEngine.LayerMask layerMask)
 {
     return(((1 << layer) & layerMask.value) != 0);
 }
Beispiel #18
0
 public static bool HasLayer(this UnityEngine.LayerMask layerMask, int layer)
 {
     return((layerMask | (1 << layer)) == layerMask);
 }
 public static bool Contains(this UnityEngine.LayerMask mask, int layer)
 {
     return(((1 << layer) & mask.value) != 0);
 }
 public static bool Contains(this UnityEngine.LayerMask mask, string layerName)
 {
     return(mask.Contains(UnityEngine.LayerMask.NameToLayer(layerName)));
 }