/// <summary> /// Start inventory closing animation /// </summary> public void CloseInventory() { this.animationState = InventoryAnimationStates.CLOSING; }
/// <summary> /// Opening inventory panel with fading feature /// </summary> /// <param name="deltaT">time value</param> private void StepOpeningAnimation(float deltaT) { var newAlpha = Mathf.SmoothStep(this.canvasGroup.alpha, 1.1f, deltaT * animationSpeed); this.canvasGroup.alpha = newAlpha; if(newAlpha >= 1.0f) { this.SetInventoryState(true); this.animationState = InventoryAnimationStates.NONE; } }
// Use this for initialization private void Start() { this.animationState = InventoryAnimationStates.NONE; this.layoutGroup = this.gameObject.GetComponent<GridLayoutGroup>(); this.canvasGroup = this.gameObject.GetComponent<CanvasGroup>(); var responsiveUtil = this.gameObject.GetComponent<ResponsiveUtil>(); if(responsiveUtil != null) responsiveUtil.CalculateSize(); this.InitInventoryPanel(); this.PopulateSlots(); this.PopulateItems(); }
/// <summary> /// Closing inventory panel with fading feature /// </summary> /// <param name="deltaT">time value</param> private void StepClosingAnimation(float deltaT) { var newAlpha = Mathf.SmoothStep(this.canvasGroup.alpha, -0.1f, deltaT * animationSpeed); this.canvasGroup.alpha = newAlpha; if(newAlpha <= 0.0f) { this.SetInventoryState(false); this.animationState = InventoryAnimationStates.NONE; } }
/// <summary> /// Start inventory opening animation /// </summary> public void OpenInventory() { this.animationState = InventoryAnimationStates.OPENING; }