Ejemplo n.º 1
0
 public virtual bool Repair(ServerPlayer a_player)
 {
     m_decayTime = m_def.decayTime;
     if (null != m_sql)
     {
         m_dbBuilding.health = 100;
         m_dbBuilding.flag   = eDbAction.update;
         m_sql.SaveBuilding(m_dbBuilding);
         m_server.SendSpecialEvent(a_player, eSpecialEvent.buildingRepaired);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
    public virtual void Init(LidServer a_server, int a_type, int a_ownerPid = 0, int a_health = 100, bool a_isNew = true)
    {
        m_isStatic  = false;
        m_server    = a_server;
        m_type      = a_type;
        m_ownerPid  = a_ownerPid;
        m_def       = Buildings.GetBuildingDef(m_type);
        m_decayTime = m_def.decayTime * (double)((float)a_health / 100f);
        if (!m_def.persistent)
        {
            return;
        }
        Vector3 position    = base.transform.position;
        float   a_x         = position.x * 1.00001f;
        Vector3 position2   = base.transform.position;
        float   a_y         = position2.z * 1.00001f;
        Vector3 eulerAngles = base.transform.rotation.eulerAngles;

        m_dbBuilding = new DatabaseBuilding(a_type, a_x, a_y, eulerAngles.y * 1.00001f, a_ownerPid, a_health);
        m_sql        = m_server.GetSql();
        if (null != m_sql)
        {
            if (a_isNew)
            {
                m_dbBuilding.flag = eDbAction.insert;
                m_sql.SaveBuilding(m_dbBuilding);
            }
            m_nextSqlUpdateTime = Random.Range(100f, 300f);
        }
    }