Пример #1
0
 public void DestroySaber()
 {
     CurrentModelComposition?.DestroyAdditionalInstances();
     CurrentSaber?.Destroy();
     CurrentSaber = null;
     CurrentPiece = null;
 }
Пример #2
0
        public SaberInstance CreateSaber(SaberModel model, Transform parent, bool raiseSaberEvent = false, bool raisePieceEvent = false)
        {
            CurrentSaber = _saberFactory.Create(model);
            CurrentSaber.SetParent(parent);

            if (raiseSaberEvent)
            {
                OnSaberInstanceCreated?.Invoke(CurrentSaber);
            }

            CurrentPiece = GetPiece(SelectedDefinition);

            if (raisePieceEvent && CurrentPiece != null)
            {
                OnPieceInstanceCreated?.Invoke(CurrentPiece);
            }

            return(CurrentSaber);
        }