public static void Door_UpdateAction(Furniture furniture, float deltaTime) { if (furniture.GetParameter(World.is_opening) >= 1) { furniture.ChangeParameter(World.openness, deltaTime * 4); if (furniture.GetParameter(World.openness) >= 1) { furniture.SetParameter(World.is_opening, 0); } } else { if (furniture.GetParameter(World.openness) > 0) { furniture.ChangeParameter(World.openness, -(deltaTime * 4)); } } furniture.SetParameter(World.openness, Mathf.Clamp01(furniture.GetParameter(World.openness))); if (furniture.onChangedCallback != null) { furniture.onChangedCallback(furniture); } }
public static void DoorUpdateAction(Furniture furniture, float deltaTime) { //Debug.Log("DoorUpdateAction " + furniture.furnitureParamaters[Config.OPENNESS]); if (furniture.GetParameter(Config.IS_OPENING) >= 1) { furniture.ChangeParameter(Config.OPENNESS, deltaTime * doorOpenSpeed); if (furniture.GetParameter(Config.OPENNESS) >= 1) { furniture.SetParameter(Config.IS_OPENING, 0); } } else { furniture.ChangeParameter(Config.OPENNESS, deltaTime * doorCloseSpeed); } furniture.SetParameter(Config.OPENNESS, Mathf.Clamp01(furniture.GetParameter(Config.OPENNESS))); if (furniture.callBackOnChanged != null) { furniture.callBackOnChanged(furniture); } }