// Update is called once per frame void Update() { if (IsInRange() == true) { _attacking.Begin(_player.GetComponentInChildren <Damage>()); } else { Vector3 next = _initPosition; if (IsArrivedWaypoint() == true) { _arrivedTime = 0.0f; _currentWaypointIndex = _waypoint.GetNextIndex(_currentWaypointIndex); } next = GetCurrentWaypoint(); if (_arrivedTime > _dwellTime) { _moving.Begin(next); } else { _arrivedTime += Time.deltaTime; } } }
private bool Attacking() { RaycastHit[] hits = Physics.RaycastAll(GetMouseRay()); //배열 자료형 만들때 []붙여버림 foreach (RaycastHit hit in hits) //range based for loop 와 유사함 { Damage damage = hit.transform.GetComponent <Damage>(); if (damage == null) { continue; } if (Input.GetMouseButton(0)) { _attacking.Begin(damage); } return(true); } return(false); }