Ejemplo n.º 1
0
    public void LoadObjects()
    {
        // !!! BUILD SCRIPT MUST BE ENABLED TO LOAD OBJECTS !!!
        objectGridPlacement = GetComponent <ObjectGrid_Placement>();

        foreach (ObjectProperties properties in GameSystem.Instance.objectList)
        {
            int        ID       = properties.objectId;
            Vector2Int position = new Vector2Int(properties.objectPositionX, properties.objectPositionY);
            float      rotation = properties.objectRotation;

            GameObject objectPrefab = GetGameObjectForId(ID);

            // No Prefab for ID
            if (objectPrefab != null)
            {
                GameObject gameObject = Instantiate(objectPrefab, Vector3.zero, Quaternion.identity);
                gameObject.transform.parent = transform;
                if (!objectGridPlacement.PlaceObjectOnGridWithRotation(gameObject, position, Vector2Int.zero, rotation))
                {
                    Destroy(gameObject);
                }
            }
        }

        GamePlaySystem.Instance.UpdateSeatList();
    }
Ejemplo n.º 2
0
    public void TestBar()
    {
        objectGridPlacement = GetComponent <ObjectGrid_Placement>();

        GameObject chair  = Instantiate(s1_Chair_Purple, Vector3.zero, Quaternion.identity);
        GameObject chair1 = Instantiate(s1_Chair_Yellow, Vector3.zero, Quaternion.identity);
        GameObject chair2 = Instantiate(s1_Chair_Yellow, Vector3.zero, Quaternion.identity);
        GameObject chair3 = Instantiate(s1_Chair_Purple, Vector3.zero, Quaternion.identity);
        GameObject chair4 = Instantiate(s1_Chair_Red, Vector3.zero, Quaternion.identity);
        GameObject chair5 = Instantiate(s1_Chair_Purple, Vector3.zero, Quaternion.identity);
        GameObject chair6 = Instantiate(s1_Chair_Purple, Vector3.zero, Quaternion.identity);
        GameObject chair7 = Instantiate(s1_Chair_Red, Vector3.zero, Quaternion.identity);
        GameObject chair8 = Instantiate(s1_Chair_Red, Vector3.zero, Quaternion.identity);
        GameObject chair9 = Instantiate(s1_Chair_Red, Vector3.zero, Quaternion.identity);

        GameObject table  = Instantiate(s1_Tabel_Purple, Vector3.zero, Quaternion.identity);
        GameObject table1 = Instantiate(s1_Tabel_Yellow, Vector3.zero, Quaternion.identity);
        GameObject table2 = Instantiate(s1_Tabel_Yellow, Vector3.zero, Quaternion.identity);
        GameObject table3 = Instantiate(s1_Tabel_Purple, Vector3.zero, Quaternion.identity);
        GameObject table4 = Instantiate(s1_Tabel_Red, Vector3.zero, Quaternion.identity);
        GameObject table5 = Instantiate(s1_Tabel_Red, Vector3.zero, Quaternion.identity);

        GameObject couchs  = Instantiate(s1_CouchS_Red, Vector3.zero, Quaternion.identity);
        GameObject couchs1 = Instantiate(s1_CouchS_Red, Vector3.zero, Quaternion.identity);

        GameObject couchl1 = Instantiate(s1_CouchL_Red, Vector3.zero, Quaternion.identity);

        chair.transform.parent  = transform;
        chair1.transform.parent = transform;
        chair2.transform.parent = transform;
        chair3.transform.parent = transform;
        chair4.transform.parent = transform;
        chair5.transform.parent = transform;
        chair6.transform.parent = transform;
        chair7.transform.parent = transform;
        chair8.transform.parent = transform;
        chair9.transform.parent = transform;

        table.transform.parent  = transform;
        table1.transform.parent = transform;
        table2.transform.parent = transform;
        table3.transform.parent = transform;
        table4.transform.parent = transform;
        table5.transform.parent = transform;

        couchs.transform.parent  = transform;
        couchs1.transform.parent = transform;

        couchl1.transform.parent = transform;

        objectGridPlacement.PlaceObjectOnGridWithRotation(chair, new Vector2Int(1, 1), Vector2Int.zero, 180);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair1, new Vector2Int(3, 1), Vector2Int.zero, 180);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair2, new Vector2Int(6, 1), Vector2Int.zero, 180);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair3, new Vector2Int(8, 1), Vector2Int.zero, 180);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair4, new Vector2Int(7, 6), Vector2Int.zero, 180);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair5, new Vector2Int(1, 3), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair6, new Vector2Int(8, 3), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair7, new Vector2Int(7, 8), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair8, new Vector2Int(6, 7), Vector2Int.zero, 270);
        objectGridPlacement.PlaceObjectOnGridWithRotation(chair9, new Vector2Int(8, 7), Vector2Int.zero, 90);

        objectGridPlacement.PlaceObjectOnGridWithRotation(table, new Vector2Int(1, 2), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(table1, new Vector2Int(3, 2), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(table2, new Vector2Int(6, 2), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(table3, new Vector2Int(8, 2), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(table4, new Vector2Int(7, 7), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(table5, new Vector2Int(2, 7), Vector2Int.zero, 0);

        objectGridPlacement.PlaceObjectOnGridWithRotation(couchs, new Vector2Int(3, 8), Vector2Int.zero, 0);
        objectGridPlacement.PlaceObjectOnGridWithRotation(couchs1, new Vector2Int(1, 5), Vector2Int.zero, 270);

        objectGridPlacement.PlaceObjectOnGridWithRotation(couchl1, new Vector2Int(1, 8), Vector2Int.zero, 0);

        GamePlaySystem.Instance.UpdateSeatList();
    }