public void UpdateServerSlot(ServerSlotState a_state, ServerSlotType a_type) { switch (a_state) { case ServerSlotState.Insert: m_currentActivatedSlots++; Insert(a_type); if (IsActivated()) { // ALL SLOTS ENABLED Debug.Log("Server [" + gameObject.name + "] activated."); GetComponent <AudioSource>().Play(); // ENABLE SOUND } break; case ServerSlotState.Remove: Remove(a_type); if (IsActivated()) { // server is currently activated, but object is pulled off // server will be deactivated Debug.Log("Server [" + gameObject.name + "] deactivated."); GetComponent <AudioSource>().Play(); // DISABLE SOUND } m_currentActivatedSlots--; break; } // update info screen m_notebookScreen.GetComponent <IServerNotebook>().ChangeState(this); }
public bool IsInserted(ServerSlotType a_type) { ServerSlotType tmp = m_currentInsertedTypes & a_type; // if tmp is the same as a_value the bit is set return(tmp == a_type); }
public void Remove(ServerSlotType a_type) { m_currentInsertedTypes ^= a_type; }
public void Insert(ServerSlotType a_type) { m_currentInsertedTypes |= a_type; }