Ejemplo n.º 1
0
 public void Dispose( )
 {
     if (this.state_ != null)
     {
         var sync = this.state_.Sync;
         this.state_ = null;
         this.Release(sync);
     }
 }
Ejemplo n.º 2
0
        public static Icon GetIcon(LockerState state)
        {
            switch (state)
            {
            case LockerState.Active:
                return(m_lockedIcon);

            case LockerState.Inactive:
                return(m_unlockedIcon);

            case LockerState.StandBy:
                return(m_clockIcon);

            default:
                return(null);
            }
        }
Ejemplo n.º 3
0
 public Readable(LockerState state) : base(state)
 {
 }
Ejemplo n.º 4
0
 public Locked(W writer, R reader)
 {
     this.state_ = new LockerState(reader, writer);
 }
Ejemplo n.º 5
0
 protected Accessor(LockerState state)
 {
     Debug.Assert(state != null);
     this.Acquire(state.Sync);
     this.state_ = state;
 }
Ejemplo n.º 6
0
 public Upgradable(LockerState state) : base(state)
 {
 }
Ejemplo n.º 7
0
 public Writable(LockerState state) : base(state)
 {
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Abrir cajon
 /// </summary>
 public void open()
 {
     currentState = LockerState.Opening;
 }
Ejemplo n.º 9
0
 public void init()
 {
     currentState     = LockerState.Closed;
     handleMinZ       = handleSphere.Center.Z;
     waintElapsedTime = 0;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Actualizar estado
        /// </summary>
        public void update()
        {
            float maxDist = 2 * handleSphere.Radius;
            float movement;
            float correction;

            switch (currentState)
            {
            //Hacer animacion de abrir cajon
            case LockerState.Opening:
                movement = movementSpeed * GuiController.Instance.ElapsedTime;

                //Mover
                mesh.move(0, 0, movement);
                handleSphere.moveCenter(new Vector3(0, 0, movement));

                //Ver si llegamos al limite
                if (handleSphere.Center.Z >= handleMaxZ)
                {
                    //Corregir lo que nos pasamos
                    correction = handleSphere.Center.Z - handleMaxZ;
                    mesh.move(0, 0, -correction);
                    handleSphere.moveCenter(new Vector3(0, 0, -correction));

                    //Pasar a estado abierto
                    currentState     = LockerState.Opened;
                    waintElapsedTime = 0;
                }

                break;

            //Abierto
            case LockerState.Opened:
                waintElapsedTime += GuiController.Instance.ElapsedTime;
                if (waintElapsedTime > WAIT_TIME)
                {
                    waintElapsedTime = WAIT_TIME;
                }
                break;

            //Cerrado
            case LockerState.Closed:
                waintElapsedTime += GuiController.Instance.ElapsedTime;
                if (waintElapsedTime > WAIT_TIME)
                {
                    waintElapsedTime = WAIT_TIME;
                }
                break;

            //Hacer animacion de cerrar cajon
            case LockerState.Closing:
                movement = -movementSpeed * GuiController.Instance.ElapsedTime;

                //Mover
                mesh.move(0, 0, movement);
                handleSphere.moveCenter(new Vector3(0, 0, movement));

                //Ver si llegamos al limite
                if (handleSphere.Center.Z <= handleMinZ)
                {
                    //Corregir lo que nos pasamos
                    correction = handleSphere.Center.Z - handleMinZ;
                    mesh.move(0, 0, -correction);
                    handleSphere.moveCenter(new Vector3(0, 0, -correction));

                    //Pasar a estado cerrado
                    currentState     = LockerState.Closed;
                    waintElapsedTime = 0;
                }
                break;
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Cerrar cajon
 /// </summary>
 public void close()
 {
     currentState = LockerState.Closing;
 }