Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        Player      = GameObject.Find("VRPLAYER");
        Cave        = GameObject.Find("동굴");
        Itemlist    = GameObject.Find("variable");
        Main_Camera = GameObject.Find("Main Camera");
        animator    = this.GetComponent <Animator> ();

        variable             = Itemlist.GetComponent <Variable>();
        npcitem              = this.GetComponent <NPCItem> ();
        agent                = GetComponent <NavMeshAgent>();
        agent.autoBraking    = false; //true : 목적지에 다가갈수록 속도가 빨라진다. false : 속도가 일정하다.
        agent.updatePosition = true;  // position값을 업데이트한다.
        agent.updateRotation = false; // rotation값은 업데이트 하지않는다.

        //자유이동 포지션 가지고 옴
        var group = GameObject.Find("WorkerWayPoint");

        if (group != null)
        {
            group.GetComponentsInChildren <Transform>(wayPoint);
            wayPoint.RemoveAt(0); //부모의  transform은 제거한다.

            nextidx = Random.Range(0, wayPoint.Count);
        }

        //초기화
        npcstate     = NPCState.FREEMOVE;
        commandstate = CommandState.NONE;
        alive        = true;

        nextidx = Random.Range(0, wayPoint.Count);

        //상태 코루틴 시작
        StartCoroutine("FSM");
    }
Ejemplo n.º 2
0
 void Awake()
 {
     instance = this;
 }