Beispiel #1
0
    public void DirtyTheClodByPlantBounds(int plantItemid, Vector3 pos, bool dirty)
    {
        Bounds _bo = PlantInfo.GetPlantBounds(plantItemid, pos);

        foreach (var ive3 in m_Clods.Keys)
        {
            if (_bo.Contains(m_Clods[ive3]))
            {
                DirtyTheClod(m_Clods[ive3], dirty);
            }
        }
    }
Beispiel #2
0
    public void FreeClodByBouds(int plantItemId, Vector3 pos, bool dirty = false)
    {
        Bounds _bo = PlantInfo.GetPlantBounds(plantItemId, pos);

        foreach (var ivc in m_Clods.Keys)
        {
            if (_bo.Contains(m_Clods[ivc]))
            {
                IntVec3 int_pos = new IntVec3(m_Clods[ivc]);
                if (!dirty && !m_IdleClods.ContainsKey(int_pos))
                {
                    m_IdleClods.Add(int_pos, 0);
                }
            }
        }
    }
Beispiel #3
0
    public bool checkRroundCanPlant(int plantItemid, Vector3 pos)
    {
        Bounds _bo = PlantInfo.GetPlantBounds(plantItemid, pos);

        float radiu = Mathf.Max(_bo.extents.x, _bo.extents.z);

        Collider[] colliders = Physics.OverlapSphere(pos, radiu, layer);
        if (colliders != null && colliders.Length != 0)
        {
            return(false);
        }

        foreach (var key in m_Plants.Keys)
        {
            if (_bo.Intersects(m_Plants[key].mPlantBounds))
            {
                return(false);
            }
        }

        return(true);
    }