void Place() { if (Cursor.CheckPlacement() == false) { return; } PixelCrushers.MessageSystem.SendMessage(this, "PropPlaced", CurrentItem.Name); GameObject spawnObj = Instantiate(ReferencedObject, Cursor.transform.position, Cursor.transform.rotation); spawnObj.transform.position = Cursor.transform.position; spawnObj.transform.rotation = Cursor.transform.rotation; spawnObj.GetComponent <ObjectPosition>().AdjustPositions(); if (spawnObj.GetComponent <OccupySpace>() != null) { if (spawnObj.GetComponent <OccupySpace>().isActiveAndEnabled) { spawnObj.GetComponent <OccupySpace>().OccupyTiles(); } } PlayerInventory.RemoveItem(CurrentItem); if (spawnObj.GetComponent <Hut>() != null) { Hut hut = spawnObj.GetComponent <Hut>(); hut.Init(); BlossomManager.Instance.AddHut(hut.Name); } if (spawnObj.GetComponent <PixelCrushers.SpawnedObject>() != null) { PixelCrushers.SpawnedObject spawnedObject = spawnObj.GetComponent <PixelCrushers.SpawnedObject>(); spawnedObject.key += " PlayerPlaced"; } AstarPath.active.Scan(); }
public static void RemoveSpawnedObjectData(SpawnedObject spawnedObject) { if (m_instance == null || spawnedObject == null) { return; } m_instance.m_spawnedObjects.Remove(spawnedObject); }
public static void AddSpawnedObjectData(SpawnedObject spawnedObject) { if (m_instance == null || spawnedObject == null) { return; } m_instance.m_spawnedObjects.Add(spawnedObject); }