Esempio n. 1
0
    // Object 생성 시작 -------------------------
    void MakeCharacter(string charactor)
    {
        GameObject CharacterRoot = GameObject.Find("CharacterRoot");
        charController = CharacterRoot.GetComponent<CharController>();

        //GameObject CharacterRoot = (GameObject)GameObject.Instantiate(Resources.Load("Prefebs/Character/pfCharacter")) as GameObject;
        //CharacterRoot.name = "CharacterRoot";
        //CharacterRoot.transform.parent = transform;

        GameObject CharacterSprite = (GameObject)GameObject.Instantiate(Resources.Load("Prefebs/Character/pfChar_" + charactor)) as GameObject;
        //GameObject CharacterSprite = GameObject.Find("CharSprite");
        CharacterSprite.name = "CharSprite";
        CharacterSprite.transform.position = CharacterRoot.transform.position;
        CharacterSprite.transform.parent = CharacterRoot.transform;

        Animator animator = CharacterSprite.transform.GetComponent<Animator>();
        charController.setInitAni(animator);
        //charController.setAni(animator);
        //GameObject.Find("GameCamera").GetComponent<GameCamera>().SetTarget(CharacterRoot.transform);
    }