/// <summary> /// 执行组件的不激活操作。 /// </summary> public async Task Inactive() { IsActived = false; await OnInactive.InvokeAsync(IsActived); StateHasChanged(); }
protected void SetActive(bool active) { if (rb != null && !rb.isKinematic) { //we can't have disabled colliders with an active rb active = true; } if (rb != null) { rb.detectCollisions = active; } else { //get rid of collider.enabled wherever possible if (HasStates && States.CurrentState != null) { if (States.CurrentState.StateCollider != null) { States.CurrentState.StateCollider.enabled = active; } } else { for (int i = 0; i < Colliders.Count; i++) { if (Colliders [i] != null) { Colliders [i].enabled = active; } } } } if (Is(WILoadState.Initialized | WILoadState.PreparingToUnload | WILoadState.Unloading)) { try { if (active) { OnActive.SafeInvoke(); } else { OnInactive.SafeInvoke(); } } catch (Exception e) { Debug.LogException(e); } } }
public void ButtonDown() { manualDropTimer -= 1.0f * Time.deltaTime; if (manualDropTimer <= 0) { dropTimer = dropDelay.Value; manualDropTimer = manualDropDelay.Value; if (droppable.CanDrop()) { droppable.Drop(); } else { OnInactive?.Invoke(); } } }
public IEnumerator DropCoroutine() { while (canControl) { if (dropTimer <= 0) { if (droppable.CanDrop()) { this.droppable.Drop(); } else { OnInactive?.Invoke(); } dropTimer = dropDelay.Value; } dropTimer -= Time.deltaTime; yield return(null); } }