private void FixedUpdate() { entity = vc.GetObjectInVisionCone(0f); timer -= Time.deltaTime; if (entity != null) { transform.up = (entity.transform.localPosition - transform.localPosition).normalized; if (timer < 0) { timer = shootTime; foreach (GameObject proj in projectileList) { if (!proj.activeSelf) { proj.transform.localPosition = transform.localPosition; proj.transform.localRotation = transform.localRotation; proj.SetActive(true); break; } } } } }
private void Update() { entity = vc.GetObjectInVisionCone(0f); timer -= Time.deltaTime; if (entity != null) { transform.up = (entity.transform.position - transform.position).normalized; if (timer < 0) { timer = shootTime; foreach (GameObject proj in projectileList) { if (!proj.activeSelf) { proj.transform.position = transform.position; proj.transform.rotation = transform.rotation; proj.SetActive(true); break; } } } } else { transform.up = GetComponentInParent <Transform>().up; } }
protected virtual void PatrolState() { pf.FollowPath(); timer -= Time.deltaTime; entity = vc.GetObjectInVisionCone(vc.locateRadius); if (timer < 0) { currentState = SharkState.ROAM; RoamStateStart(); } if (entity != null) { currentState = SharkState.IN_SIGHT; InSightStateStart(); } }