コード例 #1
0
    private void NewPlaceableClick(Placeable placeable)
    {
        Placeable newPlaceable = Instantiate(placeable);

        newPlaceable.name = placeable.name;
        currentPlaceables.Add(newPlaceable);
        newPlaceable.transform.position = placeable.GetDefaultPosition();

        selectedPlaceable = newPlaceable;
        SelectedPlaceableChanged?.Invoke(selectedPlaceable);
    }
コード例 #2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         if (selectedPlaceable != null)
         {
             currentPlaceables.Remove(selectedPlaceable);
             Destroy(selectedPlaceable.gameObject);
             selectedPlaceable = null;
             SelectedPlaceableChanged?.Invoke(null);
         }
     }
 }