Exemplo n.º 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);
        }
    }
Exemplo n.º 2
0
    public static void Door_UpdateAction(InstalledObject installedObject, float deltaTime)
    {
        // If the door isOpening is 'true' open the door a little bit more
        if (installedObject.GetParameter("isOpening") >= 1)
        {
            installedObject.ChangeParameter("OpenValue", (deltaTime * 4));

            // If door is fully opened, close it again (right away)
            if (installedObject.GetParameter("OpenValue") >= 1)
            {
                installedObject.SetParameter("isOpening", 0);
            }
        }
        // Close door again
        else
        {
            installedObject.ChangeParameter("OpenValue", (deltaTime * -4));
        }

        // Clamp value between 0 & 1
        installedObject.SetParameter("OpenValue", Mathf.Clamp01(installedObject.GetParameter("OpenValue")));

        // Call the callback if there is any
        if (installedObject.cb_OnChanged != null)
        {
            installedObject.cb_OnChanged(installedObject);
        }
    }
    public static EnterableState Door_EnterableState(InstalledObject obj)
    {
        obj.SetParameter("openingState", 1);

        if (obj.GetParameter("openness") >= 1)
        {
            return(EnterableState.Yes);
        }
        return(EnterableState.Soon);
    }
Exemplo n.º 4
0
    public static ENTERABILITY Door_IsEnterable(InstalledObject _inObj)
    {
        //if(Debug.isDebugBuild)
        //    Debug.Log("Door_IsEnterable");

        _inObj.SetParameter("is_opening", 1);

        if (_inObj.GetParameter("openness") >= 1)
        {
            return(ENTERABILITY.Yes);
        }
        return(ENTERABILITY.Soon);
    }
    public static void Door_UpdateAction(InstalledObject obj, float deltaTime)
    {
        //Debug.Log("Door_UpdateAction");
        if (obj.GetParameter("openingState") >= 1)
        {
            obj.ChangeParameter("openness", deltaTime * 4);
            if (obj.GetParameter("openness") >= 1)
            {
                obj.SetParameter("openingState", 0);
            }
        }
        else
        {
            obj.ChangeParameter("openness", deltaTime * -4);
        }

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

        if (obj.CbOnInstalledObjectChanged != null)
        {
            obj.CbOnInstalledObjectChanged(obj);
        }
    }
Exemplo n.º 6
0
    public static EnterAbility Door_IsEnterable(InstalledObject installedObject)
    {
        // Door 'isOpening' = 1, means door is opening = true
        installedObject.SetParameter("isOpening", 1);

        // If door is fully open, character can enter.
        if (installedObject.GetParameter("OpenValue") >= 1)
        {
            return(EnterAbility.Yes);
        }

        // Soon, door is going to open soonTM
        return(EnterAbility.Soon);
    }