Esempio n. 1
0
    ///マス生成
    static public MapTrout create(List <Arg> aChip)
    {
        MapTrout              tTrout              = MyBehaviour.create <MapTrout>();
        List <Arg>            tMasDataList        = new List <Arg>();                                         //マスのタイル情報リスト
        MapAttributeBehaviour tAttributeBehaviour = tTrout.gameObject.AddComponent <MapAttributeBehaviour>(); //マップ属性

        tAttributeBehaviour.setAttribute(MapBehaviourAttribute.Attribute.none);                               //マップ属性の初期値をnoneに設定
        //マスのタイル情報を読んでリストに
        foreach (Arg tData in aChip)
        {
            Arg tMasData = loadMasData(tData.get <string>("file"), tData.get <int>("x"), tData.get <int>("y"));
            tMasData.set("file", tData.get <string>("file"));
            tMasDataList.Add(tMasData);
            //マップ属性を重ねる
            tAttributeBehaviour.mAttribute.pile(tMasData.get <string>("attribute"));
        }
        //画像設定
        ChildSprite.addSpriteObject(tTrout.gameObject, new Arg(new Dictionary <string, object>()
        {
            { "pile", tMasDataList }
        }), kDirPath);
        //collider設定
        if (tAttributeBehaviour.mAttribute.attribute != MapBehaviourAttribute.Attribute.flat &&
            tAttributeBehaviour.mAttribute.attribute != MapBehaviourAttribute.Attribute.none)
        {
            BoxCollider2D tBox = tTrout.gameObject.AddComponent <BoxCollider2D>();
            tBox.size = new Vector2(1, 1);
        }
        return(tTrout);
    }
Esempio n. 2
0
 public override void initImage(Arg aArg, string aDirectory)
 {
     createChild();
     foreach (Arg tData in aArg.get <List <Arg> >("pile"))
     {
         GameObject tObject = MyBehaviour.create <MyBehaviour>().gameObject;
         tObject.transform.SetParent(mChild.gameObject.transform, false);
         ChildSprite.addSpriteObject(tObject, tData, aDirectory);
     }
 }
Esempio n. 3
0
    static public MapObject create(string aFileName, string aName, string id = "")
    {
        if (!mObjectDatas.ContainsKey(aFileName))
        {
            mObjectDatas[aFileName] = new Arg(MyJson.deserializeResourse(MapObjectCreater.kDirPath + "/" + aFileName));
        }
        Arg       tObjectData = mObjectDatas[aFileName].get <Arg>(aName);
        MapObject tMapObject  = MyBehaviour.create <MapObject>();

        tMapObject.name = (id == "") ? aName : aFileName;
        //sprite
        if (tObjectData.ContainsKey("sprite"))
        {
            //画像があるフォルダのパス
            string tPath = HandleString.cutOff(aFileName, "/");
            tPath = (tPath == "") ? MapObjectCreater.kDirPath : MapObjectCreater.kDirPath + "/" + tPath;
            Arg tData = tObjectData.get <Arg>("sprite");
            //pivotYが設定されていないなら0に設定
            if (!tData.ContainsKey("pivotY"))
            {
                tData.set("pivotY", 0f);
            }
            //スプライトセット
            ChildSprite.addSpriteObject(tMapObject.gameObject, tData, tPath);
        }
        //zIndex
        if (tObjectData.ContainsKey("zIndex"))
        {
            tMapObject.zIndex = tObjectData.get <float>("zIndex");
        }
        //マップ属性
        if (tObjectData.ContainsKey("attribute"))
        {
            tMapObject.gameObject.AddComponent <MapAttributeBehaviour>().setAttribute(tObjectData.get <string>("attribute"));
        }
        //collider設定
        if (tObjectData.ContainsKey("collider"))
        {
            Arg tColliderData = tObjectData.get <Arg>("collider");
            ColliderInstaller.addCollider(tMapObject.gameObject, tObjectData.get <Arg>("collider"));
        }
        //category
        if (tObjectData.ContainsKey("category"))
        {
        }
        return(tMapObject);
    }
 public ChildCombination(ChildSprite childSprite, ChildName childName)
 {
     ChildSprite = childSprite;
     ChildName   = childName;
 }