Esempio n. 1
0
    private void FindSpot()
    {
        _swo = FindObjectOfType<SpawnWallObjects>();
        _possibleSpots = _swo.GetPossibleWallSpots();

        SpawnableBox objToUse = _possibleSpots.Where(sbx => sbx.GetWallObject() == null).FirstOrDefault();
        if (objToUse != null) {
            _swo.RemoveSpot(objToUse);
            objToUse.SetWallObject(this);
            AlignOnCorrectWall(objToUse);
        } else {
            //Debug.LogWarning("No space for: " + gameObject.name + " disabling.");
            gameObject.SetActive(false);
        }
    }
Esempio n. 2
0
    private void FindLargeSpot()
    {
        _swo = FindObjectOfType<SpawnWallObjects>();
        _possibleSpots = _swo.GetPossibleWallSpots();

        SpawnableBox objToUse = _possibleSpots.Where(sbx => sbx.GetWallObject() == null).FirstOrDefault();
        if (objToUse != null) {
            PlaceLargeWallObj(objToUse);
        } else {
            objToUse = _possibleSpots.Where(sbx => sbx.GetWallObject() == null).LastOrDefault();
            if (objToUse != null) {
                PlaceLargeWallObj(objToUse);
            } else {
               // Debug.LogWarning("2: No space for: " + gameObject.name + " disabling.");
                gameObject.SetActive(false);
            }
        }
    }