예제 #1
0
 private void RespondToMessage(NewPrefabWasActivatedMessage message)
 {
     if (Inspector.Get().ActiveInspectorGUIIdentifier == InspectorGUIIdentifier.ObjectSnapping ||
         Inspector.Get().ActiveInspectorGUIIdentifier == InspectorGUIIdentifier.ObjectPlacement)
     {
         DestroyIfExists();
         CreateFromActivePrefabIfNotExists();
     }
 }
예제 #2
0
        public void RandomizeActivePrefab()
        {
            if (NumberOfPrefabs != 0)
            {
                int    prefabIndex     = UnityEngine.Random.Range(0, NumberOfPrefabs);
                Prefab newActivePrefab = GetPrefabByIndex(prefabIndex);

                _prefabs.MarkEntity(newActivePrefab);
                NewPrefabWasActivatedMessage.SendToInterestedListeners(newActivePrefab);
            }
        }
예제 #3
0
        public void SetActivePrefab(Prefab newActivePrefab)
        {
            if (newActivePrefab != null && !ContainsPrefab(newActivePrefab))
            {
                return;
            }
            if (PrefabActivationValidationCallback != null && !PrefabActivationValidationCallback(newActivePrefab))
            {
                return;
            }

            _prefabs.MarkEntity(newActivePrefab);
            NewPrefabWasActivatedMessage.SendToInterestedListeners(newActivePrefab);
        }
예제 #4
0
        public static void SendToInterestedListeners(Prefab newActivePrefab)
        {
            var message = new NewPrefabWasActivatedMessage(newActivePrefab);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }
예제 #5
0
 private void RespondToMessage(NewPrefabWasActivatedMessage message)
 {
     Repaint();
 }