Пример #1
0
    public static void Door_UpdateAction(InstalledObject _inObj, float _deltaTime)
    {
        //if (Debug.isDebugBuild)
        //    Debug.Log("Door_UpdateAction: " + _inObj.inObjParameters["openness"]);

        if (_inObj.GetParameter("is_opening") >= 1)
        {
            _inObj.ChangeParameter("openness", _deltaTime * 4);
            if (_inObj.GetParameter("openness") >= 1)
            {
                _inObj.SetParameter("is_opening", 0);
            }
        }
        else
        {
            _inObj.ChangeParameter("openness", -_deltaTime * 4);
        }

        _inObj.SetParameter("openness", Mathf.Clamp01(_inObj.GetParameter("openness")));

        if (_inObj.cbOnChanged != null)
        {
            _inObj.cbOnChanged(_inObj);
        }
    }