Ejemplo n.º 1
0
    void Awake()
    {
        num_of_tile = 280;
        Debug.Log("Awake 시작");
        rgdy     = GetComponent <Rigidbody>();
        tr       = GetComponent <Transform>();
        pv       = GetComponent <PhotonView>();
        Orispeed = speed;
        OriPower = power;

        pv.synchronization       = ViewSynchronization.UnreliableOnChange;
        pv.ObservedComponents[0] = this;

        //애니메이터 받아오기
        //animation = transform.FindChild(child).gameObject.GetComponent<Animator>();
        animation = transform.GetChild(0).GetComponent <Animator>();
        ckani     = 0;

        GetCommand();  //캐릭터에 맞는 command를 가져오는 함수
        //var stat = GetComponent<stat>();
        nav = GetComponent <NavMeshAgent>();
        //fullhp = stat.FULLHP; hp = fullhp; speed = stat.SPEED; power = stat.POWER;  // 스탯 가져오기
        nav.speed = speed;
        //StartCoroutine("JustWalk");// <명령어 줄이기>
        runningact = "Nothing"; //<명령어 줄이기>
        StartCoroutine(CheckCommand());
        //if (name != "babychicken")
        //    StartCoroutine(CheckAttackCommand());
        RD = goal.GetComponent <RandomDestination>();

        if (!pv.isMine)
        {
            rgdy.isKinematic = true;
            nav.enabled      = false;
        }
        currPos = tr.position;
        currRot = tr.rotation;
    }
 //The navmesh agent componet and the randomdestination componets are accessed here
 void Start()
 {
     agent             = this.GetComponent <NavMeshAgent>();
     randomdestination = GetComponent <RandomDestination>();
 }