// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); photonGM = GameObject.Find("PhotonGM").GetComponent <photonGmaeManager>(); playerName.text = photonView.Owner.NickName; if (photonView.IsMine) { cameraFlow = GameObject.Find("Main Camera").GetComponent <CameraFlow>(); cameraFlow.target = gameObject; if (photonGM.isSubuerver) { thisplayer.tag = "Subuerver"; } else { if (photonGM.anemyTag == "A") { thisplayer.tag = "A"; } if (photonGM.anemyTag == "B") { thisplayer.tag = "B"; } } } agent = this.GetComponent <NavMeshAgent>(); PlayerKinds = playerKinds.stop; StartCoroutine(this.State()); }
// Update is called once per frame void Update() { if (!photonView.IsMine) { return; } else { if (Application.platform == RuntimePlatform.Android) { if (!EventSystem.current.IsPointerOverGameObject()) { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { Vector3 pos = Input.GetTouch(0).position; Ray ray = Camera.main.ScreenPointToRay(pos); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { //animator.SetBool("run", true ani(aniState.run); agent.SetDestination(hit.point); //hitPOS = Instantiate(tuchinstance, hit.transform); agent.isStopped = false; } } if (agent.remainingDistance <= 0.2f && agent.velocity.magnitude >= 0.2f) { Debug.Log("idle"); //ani(aniState.run); agent.isStopped = true; } } } if (Input.GetMouseButton(0)) { if (!EventSystem.current.IsPointerOverGameObject()) { Debug.Log("클릭"); PlayerKinds = playerKinds.move; bAttack = true; bAI = true; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { ani(aniState.run); agent.SetDestination(hit.point); agent.isStopped = false; } } } if (agent.remainingDistance <= 0.2f && agent.velocity.magnitude >= 0.2f) { animator.SetBool("run", false); ani(aniState.idle); bAttack = true; bAI = true; agent.isStopped = true; } } }