Пример #1
0
        public void resetDefaultProperties()
        {
            PropertyData newData;
            ValueObject  valueObj;
            b2BodyObject bodyObject = GetComponent <b2BodyObject>();

            if (list.Count >= DefaultPropertiesCount)
            {
                //tag
                list[0].name            = "tag";
                list[0].type            = CustomPropertyType.String;
                list[0].value.stringVal = gameObject.tag;
                list[0].listID          = 0;
                //ID
                list[1].name = "ID";
                list[1].type = CustomPropertyType.B2BodyObject;
                list[1].value.b2BodyObjectVal = bodyObject;
                list[1].listID = 1;
                //name
                list[2].name            = "name";
                list[2].type            = CustomPropertyType.String;
                list[2].value.stringVal = gameObject.name;
                list[2].listID          = 2;
            }
            else if (list.Count == 2)
            {
                //tag
                list[0].name            = "tag";
                list[0].type            = CustomPropertyType.String;
                list[0].value.stringVal = gameObject.tag;
                list[0].listID          = 0;
                //ID
                list[1].name = "ID";
                list[1].type = CustomPropertyType.B2BodyObject;
                list[1].value.b2BodyObjectVal = bodyObject;
                list[1].listID = 1;
                //name
                valueObj           = new ValueObject();
                valueObj.stringVal = gameObject.name;
                newData            = new PropertyData("name", CustomPropertyType.String, valueObj, 2);
                list.Add(newData);
            }
            else if (list.Count == 1)
            {
                //tag
                list[0].name            = "tag";
                list[0].type            = CustomPropertyType.String;
                list[0].value.stringVal = gameObject.tag;
                list[0].listID          = 0;
                //ID
                valueObj = new ValueObject();
                valueObj.b2BodyObjectVal = bodyObject;
                newData = new PropertyData("ID", CustomPropertyType.B2BodyObject, valueObj, 1);
                list.Add(newData);
                //name
                valueObj           = new ValueObject();
                valueObj.stringVal = gameObject.name;
                newData            = new PropertyData("name", CustomPropertyType.String, valueObj, 2);
                list.Add(newData);
            }
            else
            {
                //tag
                valueObj           = new ValueObject();
                valueObj.stringVal = gameObject.tag;
                newData            = new PropertyData("tag", CustomPropertyType.String, valueObj, 0);
                list.Add(newData);
                //ID
                valueObj = new ValueObject();
                valueObj.b2BodyObjectVal = bodyObject;
                newData = new PropertyData("ID", CustomPropertyType.B2BodyObject, valueObj, 1);
                list.Add(newData);
                //name
                valueObj           = new ValueObject();
                valueObj.stringVal = gameObject.name;
                newData            = new PropertyData("name", CustomPropertyType.String, valueObj, 2);
                list.Add(newData);
            }
        }
Пример #2
0
 virtual protected void Start()
 {
     _worldObj   = gameObject.GetComponentInParent <b2WorldObject>();
     _world      = _worldObj.world;
     _bodyObject = GetComponent <b2BodyObject>();
 }