コード例 #1
0
 public static NPCFaceSingleton getInstance()
 {
     if (instance == null)
     {
         instance = new NPCFaceSingleton();
     }
     return(instance);
 }
コード例 #2
0
    public CostumeStruct getCostume()
    {
        CostumeStruct T = new CostumeStruct();

        NPCColorSingleton.ColorTuple col = NPCColorSingleton.getInstance().getRandomColor();
        NPCHatSingleton.HatTuple     hat = NPCHatSingleton.getInstance().getRandomHat();
        NPCFaceSingleton.FaceTuple   face;
        face       = new NPCFaceSingleton.FaceTuple();
        face.index = -1;
        if (!NPCHatSingleton.getInstance().checkFullFaceHat(hat.index))
        {
            face = NPCFaceSingleton.getInstance().getRandomItem();
        }
        CostumeIndexStruct idxT = new CostumeIndexStruct();

        idxT.colorIdx = col.index;
        idxT.hatIdx   = hat.index;
        idxT.faceIdx  = face.index;
        while (costumeMap.ContainsKey(idxT))
        {
            col        = NPCColorSingleton.getInstance().getRandomColor();
            hat        = NPCHatSingleton.getInstance().getRandomHat();
            face       = new NPCFaceSingleton.FaceTuple();
            face.index = -1;
            if (!NPCHatSingleton.getInstance().checkFullFaceHat(hat.index))
            {
                face = NPCFaceSingleton.getInstance().getRandomItem();
            }
            idxT.colorIdx = col.index;
            idxT.hatIdx   = hat.index;
            idxT.faceIdx  = face.index;
        }
        costumeMap[idxT] = true;
        T.color          = col.color;
        T.hat            = hat.hat;
        T.faceItem       = face.faceItem;
        return(T);
    }
コード例 #3
0
 public static void refresh()
 {
     instance = new NPCFaceSingleton();
 }