public void Dispose( ) { if (this.state_ != null) { var sync = this.state_.Sync; this.state_ = null; this.Release(sync); } }
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); } }
public Readable(LockerState state) : base(state) { }
public Locked(W writer, R reader) { this.state_ = new LockerState(reader, writer); }
protected Accessor(LockerState state) { Debug.Assert(state != null); this.Acquire(state.Sync); this.state_ = state; }
public Upgradable(LockerState state) : base(state) { }
public Writable(LockerState state) : base(state) { }
/// <summary> /// Abrir cajon /// </summary> public void open() { currentState = LockerState.Opening; }
public void init() { currentState = LockerState.Closed; handleMinZ = handleSphere.Center.Z; waintElapsedTime = 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; } }
/// <summary> /// Cerrar cajon /// </summary> public void close() { currentState = LockerState.Closing; }