public bool Sense(EvalContext context, EntityType entityToBeDetected) { IfDetector detector = context.Target.GetComponent <IfDetector>(); if (detector == null) { detector = context.Target.gameObject.AddComponent <IfDetector>(); } Moveable moveable = context.Target.GetComponent <Moveable>(); Rigidbody rb = context.Target.GetComponent <Rigidbody>(); if (moveable != null) { //block된 상황에서 부들거리는 현상을 없애기 위해 iskinematic 변환 효과 없앰 bool current = rb.isKinematic; moveable.Ungravitate(); rb.isKinematic = current; } bool value = detector.Detect(entityToBeDetected); if (moveable != null) { moveable.Gravitate(); } return(value); }
private void Awake() { meshRenderer = GetComponentInChildren <MeshRenderer>(); fire = transform.Find("fire").gameObject; sound = GetComponent <AudioSource>(); id = GetComponent <IfDetector>(); }