コード例 #1
0
    void Awake()
    {
        AccountID   = GameObject.Find("AccountID_DontDestroy").GetComponent <AccountID>().theID;
        passedID    = GameObject.Find("charID_DontDestroy").GetComponent <fromCharToCode>().name;
        ForOrder    = new GameObject[5];
        ForOrder[0] = ForBoss;
        ForOrder[1] = ForMiniBoss;
        ForOrder[2] = ForMelee;
        ForOrder[3] = ForRange;
        ForOrder[4] = ForTank;

        TextAsset JData;

        //만약 codeeditor_IDpasser에서 온 경우일 경우 이걸 해야된당...
        tempID theTempID = GameObject.Find("charID_DontDestroy").GetComponent <tempID>();

        if (theTempID != null)
        {//만약 이게 있으면?
            JData = Resources.Load(theTempID.theID + passedID + "/TargetOrder") as TextAsset;
        }
        else
        {                                                                                                                      //만약 이게 없으면?
            JData = Resources.Load("Json_AccountInfo/" + AccountID.ToString() + "/" + passedID + "/TargetOrder") as TextAsset; //끝
        }
        string jdata = JData.text;


        theTargetOrderInformation = JsonConvert.DeserializeObject <TargetOrderInformation>(jdata);
        loadOnScene();
    }
コード例 #2
0
    void Start()
    {
        print(this.transform.parent.GetChild(1).GetComponent <EachCharacterStat>().name);

        //적이면 Resources/Json_GameInfo에서 로드해야되고 아군이면 Resources/Json_AccountInfo에서 로드해야된다!
        string tempLocation = "";

        if (this.transform.parent.tag == "Enemy")
        {
            tempLocation = "Json_GameInfo/";
        }
        else if (this.transform.parent.tag == "Player")
        {
            tempLocation = "Json_AccountInfo/" + AccountID.ToString() + "/";
        }
        print(tempLocation + this.transform.parent.GetChild(1).GetComponent <EachCharacterStat>().name + "/TargetOrder");
        TextAsset JData = Resources.Load(tempLocation + this.transform.parent.GetChild(1).GetComponent <EachCharacterStat>().name + "/TargetOrder") as TextAsset;
        string    jdata = JData.text;

        theTargetOrderInformation = JsonConvert.DeserializeObject <TargetOrderInformation>(jdata);

        aimChoice = theTargetOrderInformation.closeFar;
        //theTargetOrderInformation.aimOrderArray 에 대해서도 해보기


        calculateRelativeDistance();
        decideTargetByDistance();
        createArrow();
        theArrow.transform.GetComponent <MeshRenderer>().enabled = false;
        theArrow.transform.RotateAround(transform.position, transform.right, 180f);
        LeanTween.moveY(theArrow, theArrow.transform.position.y - 0.5f, 0.5f).setEaseInOutCubic().setLoopPingPong();
    }
コード例 #3
0
 void Awake()
 {
     AccountID = GameObject.Find("AccountID_DontDestroy").GetComponent <AccountID>().theID;
     theName   = "Alice";
     theTargetOrderInformation = new TargetOrderInformation();
 }
コード例 #4
0
    public void AccountResetter(int accountID)
    {
        List <CharacterInformation_item> characters = new List <CharacterInformation_item>();

        string jdata = JsonConvert.SerializeObject(characters);

        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/CharacterInfo.json", jdata);

        string jsonData = File.ReadAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/CharacterInfo.json");

        characters = JsonConvert.DeserializeObject <List <CharacterInformation_item> >(jsonData);

        CharacterInformation_item character = new CharacterInformation_item();

        character.ID_Character_Global  = 0;
        character.ID_Character_Account = 0;
        character.name       = "Alice";
        character.level      = 1;
        character.experience = 1000;

        character.health_origin       = 100;
        character.damage_origin       = 30;
        character.weaponRange_origin  = 10;
        character.speed_origin        = 10;
        character.defense_origin      = 100;
        character.criticalRate_origin = 50;
        character.health_item         = 0;
        character.damage_item         = 0;
        character.weaponRange_item    = 0;
        character.speed_item          = 0;
        character.defense_item        = 0;
        character.criticalRate_item   = 0;
        character.health_total        = character.health_origin + character.health_item;
        character.damage_total        = character.damage_origin + character.damage_item;
        character.weaponRange_total   = character.weaponRange_origin + character.weaponRange_item;
        character.speed_total         = character.speed_origin + character.speed_item;
        character.defense_total       = character.speed_origin + character.speed_item;
        character.criticalRate_total  = character.criticalRate_origin + character.criticalRate_item;

        character.maxHealth = character.health_total;
        character.prefabID  = 3;
        characters.Add(character);

        jdata = JsonConvert.SerializeObject(characters);
        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/CharacterInfo.json", jdata);
        AssetDatabase.Refresh();
        //______________________________________________________________________________________________________________
        List <JsonEquippableItem> jsonEquippedItem = new List <JsonEquippableItem>();

        jsonEquippedItem.Add(new JsonEquippableItem("4_0_0_0", "Staff", 0f, 0f, 25f, 30f, 10f, 0f, 0f, 0f, 0f, 30f, 30f, 10f, 50f, false, -1, 0));
        jsonEquippedItem.Add(new JsonEquippableItem("5_0_0_0", "Potion", 30f, 30f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, false, -1, 1));
        jsonData = JsonConvert.SerializeObject(jsonEquippedItem);
        jsonData = JValue.Parse(jsonData).ToString(Formatting.Indented);
        File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/ItemsInfo.json", jsonData);
        //______________________________________________________________________________________________________________
        string guid          = AssetDatabase.CreateFolder("Assets/Resources/Json_AccountInfo/" + AccountCount.ToString(), "Alice");
        string newFolderPath = AssetDatabase.GUIDToAssetPath(guid);
        //______________________________________________________________________________________________________________
        TargetOrderInformation theTargetOrderInformation = new TargetOrderInformation();

        theTargetOrderInformation.closeFar      = "close";
        theTargetOrderInformation.aimOrderArray = new int[] { 4, 3, 0, 2, 1 };
        jdata = JsonConvert.SerializeObject(theTargetOrderInformation);
        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/Alice/TargetOrder.json", jdata); //ID 추가해주기
        //______________________________________________________________________________________________________________
        actionList = new List <Action_CodeModifier>();
        actionList.Add(new Action_CodeModifier(1, "useWeapon", "무기 사용", 2, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(2, "useHealthPotion", "체력 포션 사용", 3, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(3, "moveForward", "타겟에게 전진", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(4, "moveBackward", "타겟에게서 후진", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(5, "moveLeft", "타겟의 좌측으로 이동", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(6, "moveRight", "타겟의 우측으로 이동", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(7, "moveNorth", "맵의 위쪽으로 이동", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(8, "moveSouth", "맵의 아래쪽으로 이동", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(9, "moveWest", "맵의 왼쪽으로 이동", 1, 2, 0f, 0f));
        actionList.Add(new Action_CodeModifier(10, "moveEast", "맵의 오른쪽으로 이동", 1, 2, 0f, 0f));
        jdata = JsonConvert.SerializeObject(actionList);
        jdata = JValue.Parse(jdata).ToString(Formatting.Indented);
        File.WriteAllText(Application.dataPath + "/Resources/Json_AccountInfo/" + accountID.ToString() + "/Alice/ActionData.json", jdata); //ID 추가해주기
        AssetDatabase.Refresh();
    }