public static void WaterRage( ) { int[] validPointsX = new int[20]; int[] validPointsY = new int[20]; int validPoints = 0; int maxPoints; for (int a = 0; a < h / 2; a++) { for (int b = 0; b < w; b++) { if ((grid[b, a] == null) && (grid[b, a + 1]) && (validPoints < 20)) { validPointsX [validPoints] = b; validPointsY [validPoints] = a; validPoints++; } } } if (validPoints > 6) { maxPoints = Random.Range(6, validPoints); } else { maxPoints = validPoints; } validPoints--; for (int c = 0; c < maxPoints; c++) { int point = Random.Range(0, validPoints); int posX = validPointsX [point]; int posY = validPointsY [point]; bool bottom = false; while (!bottom) { // while ((grid [posX, posY] == null)&&(posY>=0)) { Instantiate(Resources.Load("Bubble"), grid [posX, posY + 1].gameObject.transform.position, Quaternion.identity); grid [posX, posY + 1].position += new Vector3(0, -1, 0); grid [posX, posY] = grid [posX, posY + 1]; grid [posX, posY + 1] = null; posY--; bottom = true; if (posY >= 0) { if (grid [posX, posY] == null) { bottom = false; } } } validPointsX [point] = validPointsX [validPoints]; validPointsY [point] = validPointsY [validPoints]; validPointsX [validPoints] = 0; validPointsY [validPoints] = 0; validPoints--; } wtr = GameObject.Find("Water").GetComponent <Bubbles> (); wtr.BlueBubbles(); }
protected internal void OnBubbleUpdated(VisualBubble bubble, BubbleGroup group) { if (Bubbles.Count >= BubblesCapSize) { Bubbles.RemoveAt(0); } var addedToEnd = false; var unreadIndicatorGuid = BubbleGroupSettingsManager.GetUnreadIndicatorGuid(this); for (int i = Bubbles.Count - 1; i >= 0; i--) { var nBubble = Bubbles[i]; var unreadIndicatorIndex = -1; if (unreadIndicatorGuid != null && unreadIndicatorGuid == nBubble.ID) { unreadIndicatorIndex = i; } if (nBubble.Time <= bubble.Time) { // adding it to the end, we can do a simple contract if (i == Bubbles.Count - 1) { addedToEnd = true; Bubbles.Add(bubble); if (bubble.Direction == Bubble.BubbleDirection.Incoming) { BubbleGroupSettingsManager.SetUnread(this, true); } } // inserting, do a full contract else { Bubbles.Insert(i + 1, bubble); } if (i >= unreadIndicatorIndex && bubble.Direction == Bubble.BubbleDirection.Outgoing) { BubbleGroupSettingsManager.SetUnreadIndicatorGuid(this, bubble.ID, false); } break; } // could not find a valid place to insert, then skip insertion. if (i == 0) { return; } } if (SendingGroup != group && addedToEnd) { SendingGroup = group; BubbleGroupEvents.RaiseSendingServiceChange(this); } RaiseBubbleInserted(bubble); }
void PlaySound(Bubbles bubble) { string color = bubble.getColor(); switch (color) { case "Blue": bubbleAudioSource.clip = bubbleAudioClips [0]; bubbleAudioSource.Play(); break; case "Red": bubbleAudioSource.clip = bubbleAudioClips [1]; bubbleAudioSource.Play(); break; case "Yellow": bubbleAudioSource.clip = bubbleAudioClips [2]; bubbleAudioSource.Play(); break; case "Green": bubbleAudioSource.clip = bubbleAudioClips [3]; bubbleAudioSource.Play(); break; case "Purple": bubbleAudioSource.clip = bubbleAudioClips [4]; bubbleAudioSource.Play(); break; } }
void Start() { //cria a bolha inicial bubbleInstance = new Bubbles(initialBubblePosition.position.x, initialBubblePosition.position.y); cannonAnimator = cannon.GetComponent <Animator> (); helper = GameObject.FindObjectOfType <Helper> (); }
public void InsertByTime(VisualBubble b) { if (Bubbles.Count > BubblesCapSize) { Bubbles.RemoveAt(0); } for (int i = Bubbles.Count - 1; i >= 0; i--) { var nBubble = Bubbles[i]; if (nBubble.Time <= b.Time) { // adding it to the end, we can do a simple contract if (i == Bubbles.Count - 1) { Bubbles.Add(b); if (b.Direction == Bubble.BubbleDirection.Incoming) { BubbleGroupSettingsManager.SetUnread(this, true); } } // inserting, do a full contract else { Bubbles.Insert(i + 1, b); } break; } // could not find a valid place to insert, then skip insertion. if (i == 0) { return; } } if (Unified == null) { _bubblesInsertedCount++; if (_bubblesInsertedCount % 100 == 0) { if (BubbleGroupSync.SupportsSyncAndIsRunning(this)) { Action doSync = async() => { using (Platform.AquireWakeLock("DisaSync")) { await Utils.Delay(1000); await BubbleGroupSync.Sync(this, true); } }; doSync(); } } } RaiseBubbleInserted(b); RaiseUnifiedBubblesUpdatedIfUnified(b); }
//Controla as mecanicas da jogada public void TakeATurn(Bubbles bubble) { Vector2 bubblePosition = bubble.bubbleObject.transform.position; int row = PositionToRow(bubblePosition); int column = PositionToColumn(bubblePosition, row); //Debug.Log(row + "\t" + column); //Se a posição for válida if (IsPositionValid(row, column) && IsConnectedToTop(row, column)) { game.matrix.bubbleMatrix [row, column] = bubble; if (IsRowFull(row)) { bubble.bubbleObject.transform.position = new Vector2(column - 9.5f, 4.5f - row); } else { bubble.bubbleObject.transform.position = new Vector2(column - 9f, 4.5f - row); } } else { // Debug.Log(IsPositionValid(row, column) + "\t" + IsConnectedToTop(row, column)); FindNewValidPosition(row, column, bubblePosition, bubble); } //Debug.Log(game.matrix.bubbleMatrix[row, column].getColor()); DestroyTrios(row, column); DestroyHangingBubbles(); gameController.AfterATurn(); }
public void UnloadFullLoad() { PartiallyLoaded = true; var lastBubble = Bubbles.Last(); Bubbles.Clear(); Bubbles.Add(lastBubble); }
public void UnloadFullUnifiedLoad() { UnifiedGroupLoaded = false; var lastBubble = Bubbles.Last(); Bubbles.Clear(); Bubbles.Add(lastBubble); }
/// <summary> /// Constructor /// </summary> public ConversationsLightModel() { // Init commands m_ItemLeftClick = new RelayCommand <object>(new Action <object>(ItemLeftClickCommand)); //ConversationsLightList = new SortableObservableCollection<ConversationLightViewModel>(new ConversationLightViewModel.ConversationLightViewModelComparer(), true); ConversationsLightList = new RangeObservableCollection <ConversationLightViewModel>(); if (CurrentApplication.USE_DUMMY_DATA) { LoadFakeConversations(); return; } // Get Rainbow SDK Objects RbBubbles = CurrentApplication.RbBubbles; RbContacts = CurrentApplication.RbContacts; RbConversations = CurrentApplication.RbConversations; // Manage event(s) from AvatarPool AvatarPool = AvatarPool.Instance; AvatarPool.ContactAvatarChanged += AvatarPool_ContactAvatarChanged; AvatarPool.BubbleAvatarChanged += AvatarPool_BubbleAvatarChanged; // Manage event(s) from Rainbow SDK about CONVERSATIONS RbConversations.ConversationCreated += RbConversations_ConversationCreated; RbConversations.ConversationRemoved += RbConversations_ConversationRemoved; RbConversations.ConversationUpdated += RbConversations_ConversationUpdated; // Manage event(s) from Rainbow SDK about CONTACTS RbContacts.ContactPresenceChanged += RbContacts_ContactPresenceChanged; RbContacts.PeerAdded += RbContacts_PeerAdded; RbContacts.PeerInfoChanged += RbContacts_PeerInfoChanged; // Manage event(s) from Rainbow SDK about BUBBLES RbBubbles.BubbleInfoUpdated += RbBubbles_BubbleInfoUpdated; // Set conversations list using cache ResetModelWithRbConversations(RbConversations.GetAllConversationsFromCache()); // Get first conversation and load its stream if (ConversationsLightList.Count > 0) { CurrentApplication.ApplicationMainWindow.SetConversationIdSelectionFromConversationsList(ConversationsLightList[0].Id); } // Now allow Avatar download AvatarPool.AllowAvatarDownload(true); // Now allow to ask server info about unknown contacts AvatarPool.AllowToAskInfoForUnknownContact(true); }
public void Update(DestinyDestinationDefinition?other) { if (other is null) { return; } if (!DisplayProperties.DeepEquals(other.DisplayProperties)) { DisplayProperties.Update(other.DisplayProperties); OnPropertyChanged(nameof(DisplayProperties)); } if (PlaceHash != other.PlaceHash) { PlaceHash = other.PlaceHash; OnPropertyChanged(nameof(PlaceHash)); } if (DefaultFreeroamActivityHash != other.DefaultFreeroamActivityHash) { DefaultFreeroamActivityHash = other.DefaultFreeroamActivityHash; OnPropertyChanged(nameof(DefaultFreeroamActivityHash)); } if (!ActivityGraphEntries.DeepEqualsList(other.ActivityGraphEntries)) { ActivityGraphEntries = other.ActivityGraphEntries; OnPropertyChanged(nameof(ActivityGraphEntries)); } if (!BubbleSettings.DeepEqualsList(other.BubbleSettings)) { BubbleSettings = other.BubbleSettings; OnPropertyChanged(nameof(BubbleSettings)); } if (!Bubbles.DeepEqualsList(other.Bubbles)) { Bubbles = other.Bubbles; OnPropertyChanged(nameof(Bubbles)); } if (Hash != other.Hash) { Hash = other.Hash; OnPropertyChanged(nameof(Hash)); } if (Index != other.Index) { Index = other.Index; OnPropertyChanged(nameof(Index)); } if (Redacted != other.Redacted) { Redacted = other.Redacted; OnPropertyChanged(nameof(Redacted)); } }
public bool DeepEquals(DestinyDestinationDefinition?other) { return(other is not null && (DisplayProperties is not null ? DisplayProperties.DeepEquals(other.DisplayProperties) : other.DisplayProperties is null) && PlaceHash == other.PlaceHash && DefaultFreeroamActivityHash == other.DefaultFreeroamActivityHash && ActivityGraphEntries.DeepEqualsList(other.ActivityGraphEntries) && BubbleSettings.DeepEqualsList(other.BubbleSettings) && Bubbles.DeepEqualsList(other.Bubbles) && Hash == other.Hash && Index == other.Index && Redacted == other.Redacted); }
public bool DeepEquals(DestinyDestinationDefinition other) { return(other != null && ActivityGraphEntries.DeepEqualsReadOnlyCollections(other.ActivityGraphEntries) && DisplayProperties.DeepEquals(other.DisplayProperties) && DefaultFreeroamActivity.DeepEquals(other.DefaultFreeroamActivity) && Bubbles.DeepEqualsReadOnlyCollections(other.Bubbles) && //EqualityComparer<ReadOnlyCollection<DestinationBubbleSettingsEntry>>.Default.Equals(BubbleSettings, other.BubbleSettings) && Place.DeepEquals(other.Place) && Blacklisted == other.Blacklisted && Hash == other.Hash && Index == other.Index && Redacted == other.Redacted); }
public static void Main() { Fish [] fishes = new Fish[8]; fishes[0] = new Fish(); fishes[1] = new Clownfish(4, 5, 20, 30); fishes[2] = new Bluefish(6, 8, 10, 15); fishes[3] = new Clownfish(3, 8, 40, 60); fishes[4] = new SeaHorse(3, 6, 20, 50); fishes[5] = new Bluefish(2, 9, 20, 70); fishes[6] = new SeaHorse(4, 8, 30, 20); fishes[7] = new Clownfish(3, 9, 10, 10); Bubbles burbuji = new Bubbles(20); }
private void Setup(string id) { if (id == null) { ID = Guid.NewGuid().ToString(); } else { ID = id; } var firstBubble = Bubbles.First(); NeedsSync = firstBubble.Service is BubbleGroupSync.Agent; }
public bool Equals(DestinyDestinationDefinition input) { if (input == null) { return(false); } return (( DisplayProperties == input.DisplayProperties || (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties)) ) && ( PlaceHash == input.PlaceHash || (PlaceHash.Equals(input.PlaceHash)) ) && ( DefaultFreeroamActivityHash == input.DefaultFreeroamActivityHash || (DefaultFreeroamActivityHash.Equals(input.DefaultFreeroamActivityHash)) ) && ( ActivityGraphEntries == input.ActivityGraphEntries || (ActivityGraphEntries != null && ActivityGraphEntries.SequenceEqual(input.ActivityGraphEntries)) ) && ( BubbleSettings == input.BubbleSettings || (BubbleSettings != null && BubbleSettings.SequenceEqual(input.BubbleSettings)) ) && ( Bubbles == input.Bubbles || (Bubbles != null && Bubbles.SequenceEqual(input.Bubbles)) ) && ( Hash == input.Hash || (Hash.Equals(input.Hash)) ) && ( Index == input.Index || (Index.Equals(input.Index)) ) && ( Redacted == input.Redacted || (Redacted != null && Redacted.Equals(input.Redacted)) )); }
private void InitializeRainbowSDK() { rainbowApplication = new Rainbow.Application();; // Set Application Id, Secret Key and Host Name rainbowApplication.SetApplicationInfo(APP_ID, APP_SECRET_KEY); rainbowApplication.SetHostInfo(HOST_NAME); // Get Rainbow main objects rainbowBubbles = rainbowApplication.GetBubbles(); rainbowContacts = rainbowApplication.GetContacts(); // EVENTS WE WANT TO MANAGE SOME EVENTS rainbowApplication.ConnectionStateChanged += RainbowApplication_ConnectionStateChanged; rainbowBubbles.ConferenceUpdated += RainbowBubbles_ConferenceUpdated; // Init other objects }
public Bubbles[,] bubbleMatrix; //array com as bolhas do jogo //construtor public Matrix(int rows, int columns, Vector2 initialPosition, int distance) { isFirstRowFull = true; bool fullRow = true; //se a linha tem o maximo de colunas Vector2 newPosition = initialPosition; //nova posição de acordo com a bolha anterior int newColumns = columns; //quantidade de colunas bubbleMatrix = new Bubbles[11, columns]; //inicializador da array //constroi a matriz inicial for (int i = 0; i < rows; i++) { if (fullRow) { newPosition.x = initialPosition.x; newColumns = columns; } else { newPosition.x = initialPosition.x + 0.5f; newColumns = columns - 1; } for (int j = 0; j < newColumns; j++) { bubbleMatrix [i, j] = new Bubbles(newPosition.x, newPosition.y); bubbleMatrix [i, j].bubbleObjectController.isMoving = false; bubbleMatrix [i, j].bubbleObject.tag = "Bubble"; bubbleMatrix [i, j].bubbleObject.layer = 12; newPosition.x += distance; } newPosition.y -= distance; fullRow = !fullRow; } //debug /*for (int i = 0; i < rows; i ++) { * for (int j = 0; j < columns; j++) { * try { * Debug.Log (bubbleMatrix [i, j].getColor ()); * } catch (System.NullReferenceException) { * } * } * }*/ }
public static void Main() { ConsoleKeyInfo key; bool finished = false; Fishes myFish = new Fishes(); Environment myEnv = new Environment(); Coral myCoral = new Coral(); SeaWeed myWeed = new SeaWeed(); Rocks myRock = new Rocks(); Bubbles myBubble = new Bubbles(); while (!finished) { Console.Clear(); myFish.Draw(); myFish.Move(); myEnv.Draw(); myCoral.Draw(); myWeed.Draw(); myRock.Draw(); myBubble.Draw(); Thread.Sleep(100); if (Console.KeyAvailable) { key = Console.ReadKey(); if (key.Key == ConsoleKey.Escape) { finished = true; } } } Console.Clear(); Console.SetCursorPosition(35, 12); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Bye Bye!"); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Hello Bubble Sort World"); Console.WriteLine("Not the most efficient way to sort but the easiest to code before watching Game of Thrones."); Console.WriteLine(""); Bubbles bubbles = new Bubbles(); int[] myNumbers = new int[12] { 4, 76, 22, 23, 24, 67, 99, 14, 15, 10, 8, 5 }; //bubbles.numArrSort(myNumbers); Console.WriteLine($"Input array: {string.Join(", ", myNumbers)}"); Console.WriteLine($"Bubble Sorted: {String.Join(", ", bubbles.numArrSort(myNumbers))}"); Console.WriteLine(""); Console.WriteLine("Printed line by line"); Console.WriteLine($"Input array: {string.Join(", ", myNumbers)}"); printsEveryLine(myNumbers); Console.ReadLine(); }
//Acha uma nova posiçao valida void FindNewValidPosition(int firstRow, int firstColumn, Vector2 bubblePosition, Bubbles bubble) { int newRow = firstRow, newColumn = firstColumn; Vector2 newPosition = new Vector2(ColumnToPosition(firstColumn, firstRow), RowToPosition(firstRow)); //Verifica se a posiçao valida e conectada e para o lado, para o outro, e/ou para baixo //Se a nova posiçao existir na grid, se for valida (nao tem bolha la e esta conectada ao topo), e se for menor que a anterior, vira a nova posiçao //Direita if (((IsRowFull(firstRow) && firstColumn < 19) || (!IsRowFull(firstRow) && firstColumn < 18)) && ((IsPositionValid(firstRow, firstColumn + 1)) && IsConnectedToTop(firstRow, firstColumn + 1))) { newPosition = new Vector2(ColumnToPosition(firstColumn + 1, firstRow), RowToPosition(firstRow)); //Debug.Log ("Direita"); } //Esquerda if ((firstColumn > 0) && ((IsPositionValid(firstRow, firstColumn - 1)) && IsConnectedToTop(firstRow, firstColumn - 1)) && (Vector2.Distance(bubblePosition, new Vector2(ColumnToPosition(firstColumn - 1, firstRow), RowToPosition(firstRow))) < Vector2.Distance(bubblePosition, newPosition))) { newPosition = new Vector2(ColumnToPosition(firstColumn - 1, firstRow), RowToPosition(firstRow)); //Debug.Log ("Esquerda"); } //Embaixo / direita if (((firstRow < 10) && (IsRowFull(firstRow + 1) && firstColumn < 19) || (!IsRowFull(firstRow + 1) && firstColumn < 18)) && ((IsPositionValid(firstRow + 1, firstColumn + 1)) && IsConnectedToTop(firstRow + 1, firstColumn + 1)) && (Vector2.Distance(bubblePosition, new Vector2(ColumnToPosition(firstColumn + 1, firstRow + 1), RowToPosition(firstRow + 1))) < Vector2.Distance(bubblePosition, newPosition))) { newPosition = new Vector2(ColumnToPosition(firstColumn + 1, firstRow + 1), RowToPosition(firstRow + 1)); //Debug.Log ("Embaixo / direita"); } //Embaixo / esquerda if (((firstRow < 10) && (firstColumn > 0)) && ((IsPositionValid(firstRow + 1, firstColumn - 1)) && IsConnectedToTop(firstRow + 1, firstColumn - 1)) && (Vector2.Distance(bubblePosition, new Vector2(ColumnToPosition(firstColumn - 1, firstRow + 1), RowToPosition(firstRow + 1))) < Vector2.Distance(bubblePosition, newPosition))) { newPosition = new Vector2(ColumnToPosition(firstColumn - 1, firstRow + 1), RowToPosition(firstRow + 1)); //Debug.Log ("Embaixo / esquerda"); } //Acima / direita if (((firstRow > 0) && (IsRowFull(firstRow - 1) && firstColumn < 19) || (!IsRowFull(firstRow - 1) && firstColumn < 18)) && ((IsPositionValid(firstRow - 1, firstColumn + 1)) && IsConnectedToTop(firstRow - 1, firstColumn + 1)) && (Vector2.Distance(bubblePosition, new Vector2(ColumnToPosition(firstColumn + 1, firstRow - 1), RowToPosition(firstRow - 1))) < Vector2.Distance(bubblePosition, newPosition))) { newPosition = new Vector2(ColumnToPosition(firstColumn + 1, firstRow - 1), RowToPosition(firstRow - 1)); //Debug.Log ("Acima / direita"); } //Acima / esquerda if (((firstRow > 0) && (firstColumn > 0)) && ((IsPositionValid(firstRow - 1, firstColumn - 1)) && IsConnectedToTop(firstRow - 1, firstColumn - 1)) && (Vector2.Distance(bubblePosition, new Vector2(ColumnToPosition(firstColumn - 1, firstRow - 1), RowToPosition(firstRow - 1))) < Vector2.Distance(bubblePosition, newPosition))) { newPosition = new Vector2(ColumnToPosition(firstColumn - 1, firstRow - 1), RowToPosition(firstRow - 1)); //Debug.Log ("Acima / esquerda"); } newRow = PositionToRow(newPosition); newColumn = PositionToColumn(newPosition, newRow); ////Debug.Log(bubblePosition + "\t" + newPosition); ////Debug.Log(newRow + "\t" + newColumn); game.matrix.bubbleMatrix [newRow, newColumn] = bubble; if (IsRowFull(newRow)) { bubble.bubbleObject.transform.position = new Vector2(newColumn - 9.5f, 4.5f - newRow); } else { bubble.bubbleObject.transform.position = new Vector2(newColumn - 9f, 4.5f - newRow); } }
void FixedUpdate() { if (GameController.playing) { if (canShoot) { //controle de mouse e teclado (TODO CONTROLE COM TOUCH) float h = Input.GetAxisRaw("Horizontal"); float mouseMovement = Input.GetAxis("Mouse X"); diff = Camera.main.ScreenToWorldPoint(Input.mousePosition) - cannon.transform.position; //normalize difference diff.Normalize(); //calculate rotation if (mouseMovement != 0) { rotZ = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg; } else if (h != 0) { rotZ -= h * 100 * Time.deltaTime; } //apply to object //Debug.Log(rotZ); if (rotZ > 170) { rotZ = 170; } else if (rotZ < 10) { rotZ = 10; } else { cannon.transform.rotation = Quaternion.Euler(0, 0, rotZ); } } //atira a bolha if ((Input.GetMouseButtonDown(0) || Input.GetKey("space")) && shot == false && canShoot == true) { canShoot = false; //faz a bolha se mover thrownBubble = bubbleInstance; thrownBubble.bubbleObject.GetComponent <Rigidbody2D> ().isKinematic = false; thrownBubble.bubbleObject.transform.position = cannon.transform.position; thrownBubble.bubbleObject.GetComponent <Rigidbody2D> ().velocity = cannon.transform.right * 17; cannonAnimator.SetTrigger("Shoot"); PlaySound(thrownBubble); girlAnim.SetTrigger("Play"); shot = true; } } //faz a bolha parar if (shot && !thrownBubble.bubbleObjectController.isMoving) { // Debug.Log (thrownBubble.bubbleObjectController.isMoving); if (thrownBubble.bubbleObject != null) { thrownBubble.bubbleObject.GetComponent <Rigidbody2D> ().isKinematic = true; helper.TakeATurn(thrownBubble); } } if (canShoot && shot) { //cria a proxima bolha bubbleInstance = new Bubbles(initialBubblePosition.position.x, initialBubblePosition.position.y, helper.ShootableColor()); shot = false; } }
public void Say(string textToSay, Bubbles bubbleType = Bubbles.Normal, float speed = -1, int fontSize = 25, GameObject target = null, bool autoPlay = false) => StartCoroutine(PlayText(textToSay, bubbleType, speed, fontSize, target, autoPlay));
} // Need to be public - Used as Binding from XAML public FavoritesModel() { //FavoritesList = new RangeObservableCollection<FavoriteViewModel>(new FavoriteViewModel.FavoriteViewModelComparer()); FavoritesList = new RangeObservableCollection <FavoriteViewModel>(); if (CurrentApplication.USE_DUMMY_DATA) { LoadFakeConversations(); return; } // Get Rainbow SDK Objects RbBubbles = CurrentApplication.RbBubbles; RbContacts = CurrentApplication.RbContacts; RbConversations = CurrentApplication.RbConversations; RbFavorites = CurrentApplication.RbFavorites; // Manage event(s) from AvatarPool AvatarPool = AvatarPool.Instance; AvatarPool.ContactAvatarChanged += AvatarPool_ContactAvatarChanged; AvatarPool.BubbleAvatarChanged += AvatarPool_BubbleAvatarChanged; // Manage event(s) from Rainbow SDK about FAVORITES RbFavorites.FavoriteCreated += RbFavorites_FavoriteCreated; RbFavorites.FavoriteRemoved += RbFavorites_FavoriteRemoved; RbFavorites.FavoriteUpdated += RbFavorites_FavoriteUpdated; // Manage event(s) from Rainbow SDK about CONVERSATIONS // RbConversations.ConversationRemoved += RbConversations_ConversationRemoved; // A converation removed doesn't mean the favorties is removed RbConversations.ConversationUpdated += RbConversations_ConversationUpdated; // Manage event(s) from Rainbow SDK about CONTACTS RbContacts.ContactPresenceChanged += RbContacts_ContactPresenceChanged; RbContacts.PeerAdded += RbContacts_PeerAdded; RbContacts.PeerInfoChanged += RbContacts_PeerInfoChanged; // Manage event(s) from Rainbow SDK about BUBBLES RbBubbles.BubbleInfoUpdated += RbBubbles_BubbleInfoUpdated; // Set favorites list using cache Task task = new Task(() => { // Get favorites list List <Favorite> list = RbFavorites.GetFavorites(); if ((list != null) && (list.Count > 0)) { // We need to update UI so we nend to be on correct Thread if (System.Windows.Application.Current != null) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { ResetModelWithRbFavorites(list); })); } } }); task.Start(); }
public override void OnInspectorGUI() { Color warningColor = new Color32(255, 174, 0, 255); Color warningColor2 = Color.yellow; Color dColor = new Color32(175, 175, 175, 255); Color aColor = Color.white; var warningStyle = new GUIStyle(GUI.skin.label); warningStyle.normal.textColor = warningColor; warningStyle.fontStyle = FontStyle.Bold; var warningStyle2 = new GUIStyle(GUI.skin.label); warningStyle2.normal.textColor = warningColor2; warningStyle2.fontStyle = FontStyle.Bold; GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; if (UnityEditor.EditorApplication.isPlaying) { GUI.enabled = false; } SerializedProperty updateDivisor = serializedObject.FindProperty("updateDivisor"); float cupdateDivisor = updateDivisor.intValue; updateDivisor.intValue = (int)EditorGUILayout.Slider("Frame Skipping", cupdateDivisor, 1f, 10); GUI.enabled = true; if (updateDivisor.intValue > 4) { EditorGUILayout.LabelField("Will cause choppy movement", warningStyle); } else if (updateDivisor.intValue > 2) { EditorGUILayout.LabelField("Can cause choppy movement ", warningStyle2); } EditorGUILayout.EndVertical(); // GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; serializedObject.Update(); EditorGUILayout.PropertyField(myProperty, new GUIContent("Fish Prefabs"), true); serializedObject.ApplyModifiedProperties(); EditorGUILayout.LabelField("Prefabs must have SchoolChild component", EditorStyles.miniLabel); EditorGUILayout.EndVertical(); // GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Grouping", EditorStyles.boldLabel); EditorGUILayout.LabelField("Move fish into a parent transform", EditorStyles.miniLabel); SerializedProperty groupChildToSchool = serializedObject.FindProperty("groupChildToSchool"); groupChildToSchool.boolValue = EditorGUILayout.Toggle("Group to School", groupChildToSchool.boolValue); if (groupChildToSchool.boolValue) { GUI.enabled = false; } // SerializedProperty groupChildToNewTransform = serializedObject.FindProperty("groupChildToNewTransform"); groupChildToNewTransform.boolValue = EditorGUILayout.Toggle("Group to New GameObject", groupChildToNewTransform.boolValue); SerializedProperty groupName = serializedObject.FindProperty("groupName"); groupName.stringValue = EditorGUILayout.TextField("Group Name", groupName.stringValue); GUI.enabled = true; EditorGUILayout.EndVertical(); // GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Bubbles", EditorStyles.boldLabel); EditorGUILayout.PropertyField(bubbles, new GUIContent("Bubbles Object"), true); if (bubbles.objectReferenceValue) { Bubbles bubble = bubbles.objectReferenceValue as Bubbles; bubble.emitEverySecond = EditorGUILayout.FloatField("Emit Every Second", bubble.emitEverySecond); bubble.speedEmitMultplier = EditorGUILayout.FloatField("Fish Speed Emit Multiplier", bubble.speedEmitMultplier); bubble.minBubbles = EditorGUILayout.IntField("Minimum Bubbles Emitted", bubble.minBubbles); bubble.maxBubbles = EditorGUILayout.IntField("Maximum Bubbles Emitted", bubble.maxBubbles); if (GUI.changed) { EditorUtility.SetDirty(bubble); } } EditorGUILayout.EndVertical(); // GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Area Size", EditorStyles.boldLabel); EditorGUILayout.LabelField("Size of area the school roams within", EditorStyles.miniLabel); SerializedProperty positionSphere = serializedObject.FindProperty("positionSphere"); positionSphere.floatValue = EditorGUILayout.FloatField("Roaming Area Width", positionSphere.floatValue); SerializedProperty positionSphereDepth = serializedObject.FindProperty("positionSphereDepth"); positionSphereDepth.floatValue = EditorGUILayout.FloatField("Roaming Area Depth", positionSphereDepth.floatValue); SerializedProperty positionSphereHeight = serializedObject.FindProperty("positionSphereHeight"); positionSphereHeight.floatValue = EditorGUILayout.FloatField("Roaming Area Height", positionSphereHeight.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; // EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Size of the school", EditorStyles.boldLabel); EditorGUILayout.LabelField("Size of area the Fish swim towards", EditorStyles.miniLabel); SerializedProperty childAmount = serializedObject.FindProperty("childAmount"); childAmount.intValue = (int)EditorGUILayout.Slider("Fish Amount", childAmount.intValue, 1, 500); SerializedProperty spawnSphere = serializedObject.FindProperty("spawnSphere"); spawnSphere.floatValue = EditorGUILayout.FloatField("School Width", spawnSphere.floatValue); SerializedProperty spawnSphereDepth = serializedObject.FindProperty("spawnSphereDepth"); spawnSphereDepth.floatValue = EditorGUILayout.FloatField("School Depth", spawnSphereDepth.floatValue); SerializedProperty spawnSphereHeight = serializedObject.FindProperty("spawnSphereHeight"); spawnSphereHeight.floatValue = EditorGUILayout.FloatField("School Height", spawnSphereHeight.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Speed and Movement ", EditorStyles.boldLabel); EditorGUILayout.LabelField("Change Fish speed, rotation and movement behaviors", EditorStyles.miniLabel); SerializedProperty childSpeedMultipler = serializedObject.FindProperty("childSpeedMultipler"); childSpeedMultipler.floatValue = EditorGUILayout.FloatField("Random Speed Multiplier", childSpeedMultipler.floatValue); SerializedProperty SpeedCurveMultiplier = serializedObject.FindProperty("SpeedCurveMultiplier"); SpeedCurveMultiplier.animationCurveValue = EditorGUILayout.CurveField("Speed Curve Multiplier", SpeedCurveMultiplier.animationCurveValue); if (childSpeedMultipler.floatValue < 0.01f) { childSpeedMultipler.floatValue = 0.01f; } SerializedProperty minSpeed = serializedObject.FindProperty("minSpeed"); minSpeed.floatValue = EditorGUILayout.FloatField("Min Speed", minSpeed.floatValue); SerializedProperty maxSpeed = serializedObject.FindProperty("maxSpeed"); maxSpeed.floatValue = EditorGUILayout.FloatField("Max Speed", maxSpeed.floatValue); SerializedProperty acceleration = serializedObject.FindProperty("acceleration"); acceleration.floatValue = EditorGUILayout.Slider("Fish Acceleration", acceleration.floatValue, 0.001f, 0.07f); SerializedProperty brake = serializedObject.FindProperty("brake"); brake.floatValue = EditorGUILayout.Slider("Fish Brake Power", brake.floatValue, 0.001f, 0.025f); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Rotation Damping", EditorStyles.boldLabel); EditorGUILayout.LabelField("Bigger number damping will make Fish turn faster", EditorStyles.miniLabel); SerializedProperty minDamping = serializedObject.FindProperty("minDamping"); minDamping.floatValue = EditorGUILayout.FloatField("Min Damping Turns", minDamping.floatValue); SerializedProperty maxDamping = serializedObject.FindProperty("maxDamping"); maxDamping.floatValue = EditorGUILayout.FloatField("Max Damping Turns", maxDamping.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Randomize Fish Size ", EditorStyles.boldLabel); EditorGUILayout.LabelField("Change scale of Fish when they are added to the stage", EditorStyles.miniLabel); SerializedProperty minScale = serializedObject.FindProperty("minScale"); minScale.floatValue = EditorGUILayout.FloatField("Min Scale", minScale.floatValue); SerializedProperty maxScale = serializedObject.FindProperty("maxScale"); maxScale.floatValue = EditorGUILayout.FloatField("Max Scale", maxScale.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Fish Random Animation Speeds", EditorStyles.boldLabel); EditorGUILayout.LabelField("Animation speeds are also increased by movement speed", EditorStyles.miniLabel); SerializedProperty minAnimationSpeed = serializedObject.FindProperty("minAnimationSpeed"); minAnimationSpeed.floatValue = EditorGUILayout.FloatField("Min Animation Speed", minAnimationSpeed.floatValue); SerializedProperty maxAnimationSpeed = serializedObject.FindProperty("maxAnimationSpeed"); maxAnimationSpeed.floatValue = EditorGUILayout.FloatField("Max Animation Speed", maxAnimationSpeed.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Fish Waypoint Distance", EditorStyles.boldLabel); EditorGUILayout.LabelField("Waypoints inside small sphere", EditorStyles.miniLabel); SerializedProperty waypointDistance = serializedObject.FindProperty("waypointDistance"); waypointDistance.floatValue = EditorGUILayout.FloatField("Distance To Waypoint", waypointDistance.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Fish Triggers School Waypoint", EditorStyles.boldLabel); EditorGUILayout.LabelField("Fish waypoint triggers a new School waypoint", EditorStyles.miniLabel); SerializedProperty childTriggerPos = serializedObject.FindProperty("childTriggerPos"); childTriggerPos.boolValue = EditorGUILayout.Toggle("Fish Trigger Waypoint", childTriggerPos.boolValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Automaticly New Waypoint", EditorStyles.boldLabel); EditorGUILayout.LabelField("Automaticly trigger new school waypoint", EditorStyles.miniLabel); SerializedProperty autoRandomPosition = serializedObject.FindProperty("autoRandomPosition"); autoRandomPosition.boolValue = EditorGUILayout.Toggle("Auto School Waypoint", autoRandomPosition.boolValue); if (autoRandomPosition.boolValue) { SerializedProperty randomPositionTimerMin = serializedObject.FindProperty("randomPositionTimerMin"); randomPositionTimerMin.floatValue = EditorGUILayout.FloatField("Min Delay", randomPositionTimerMin.floatValue); SerializedProperty randomPositionTimerMax = serializedObject.FindProperty("randomPositionTimerMax"); randomPositionTimerMax.floatValue = EditorGUILayout.FloatField("Max Delay", randomPositionTimerMax.floatValue); if (randomPositionTimerMin.floatValue < 1) { randomPositionTimerMin.floatValue = 1; } if (randomPositionTimerMax.floatValue < 1) { randomPositionTimerMax.floatValue = 1; } } EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Fish Force School Waypoint", EditorStyles.boldLabel); EditorGUILayout.LabelField("Force all Fish to change waypoints when school changes waypoint", EditorStyles.miniLabel); SerializedProperty forceChildWaypoints = serializedObject.FindProperty("forceChildWaypoints"); forceChildWaypoints.boolValue = EditorGUILayout.Toggle("Force Fish Waypoints", forceChildWaypoints.boolValue); EditorGUILayout.Space(); EditorGUILayout.LabelField("Force New Waypoint Delay", EditorStyles.boldLabel); EditorGUILayout.LabelField("How many seconds until the Fish in school will change waypoint", EditorStyles.miniLabel); SerializedProperty forcedRandomDelay = serializedObject.FindProperty("forcedRandomDelay"); forcedRandomDelay.floatValue = EditorGUILayout.FloatField("Waypoint Delay", forcedRandomDelay.floatValue); EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; EditorGUILayout.LabelField("Obstacle Avoidance", EditorStyles.boldLabel); EditorGUILayout.LabelField("Steer and push away from obstacles (uses more CPU)", EditorStyles.miniLabel); SerializedProperty avoidance = serializedObject.FindProperty("avoidance"); avoidance.boolValue = EditorGUILayout.Toggle("Avoidance (enable/disable)", avoidance.boolValue); if (avoidance.boolValue) { SerializedProperty avoidAngle = serializedObject.FindProperty("avoidance"); avoidAngle.floatValue = EditorGUILayout.Slider("Avoid Angle", avoidAngle.floatValue, 0.05f, 0.95f); SerializedProperty avoidDistance = serializedObject.FindProperty("avoidDistance"); avoidDistance.floatValue = EditorGUILayout.FloatField("Avoid Distance", avoidDistance.floatValue); if (avoidDistance.floatValue <= 0.1) { avoidDistance.floatValue = 0.1f; } SerializedProperty avoidSpeed = serializedObject.FindProperty("avoidSpeed"); avoidSpeed.floatValue = EditorGUILayout.FloatField("Avoid Speed", avoidSpeed.floatValue); SerializedProperty stopDistance = serializedObject.FindProperty("stopDistance"); stopDistance.floatValue = EditorGUILayout.FloatField("Stop Distance", stopDistance.floatValue); SerializedProperty stopSpeedMultiplier = serializedObject.FindProperty("stopSpeedMultiplier"); stopSpeedMultiplier.floatValue = EditorGUILayout.FloatField("Stop Speed Multiplier", stopSpeedMultiplier.floatValue); if (stopDistance.floatValue <= 0.1f) { stopDistance.floatValue = 0.1f; } } EditorGUILayout.EndVertical(); // GUI.color = dColor; EditorGUILayout.BeginVertical("Box"); GUI.color = Color.white; SerializedProperty push = serializedObject.FindProperty("push"); push.boolValue = EditorGUILayout.Toggle("Push (enable/disable)", push.boolValue); if (push.boolValue) { SerializedProperty pushDistance = serializedObject.FindProperty("pushDistance"); pushDistance.floatValue = EditorGUILayout.FloatField("Push Distance", pushDistance.floatValue); if (pushDistance.floatValue <= 0.1f) { pushDistance.floatValue = 0.1f; } SerializedProperty pushForce = serializedObject.FindProperty("pushForce"); pushForce.floatValue = EditorGUILayout.FloatField("Push Force", pushForce.floatValue); if (pushForce.floatValue <= 0.01f) { pushForce.floatValue = 0.01f; } } EditorGUILayout.EndVertical(); // if (GUI.changed) { EditorUtility.SetDirty(target); } serializedObject.ApplyModifiedProperties(); }
private void EmitBubbles() { Bubbles bubbles = Instantiate(bubblesPrefab, bubblePoint); // soundManager.PlayBubbles(); }
public IEnumerator <VisualBubble> GetEnumerator() { return(Bubbles.GetEnumerator()); }
public int CountExcludingNewBubbles() { return(Bubbles.CountEx(x => !(x is NewBubble))); }
public void RemoveBubble(VisualBubble bubble) { Bubbles.Remove(bubble); }
private IEnumerator PlayText(string textToSay, Bubbles bubbleType, float textSpeed, int fontSize, GameObject target, bool autoPlay) { int textNumber = textBeforeCall; textBeforeCall += 1; yield return(new WaitUntil(() => (textNumber == activeText && !turnOff) || clear)); if (clear) { yield return(new WaitForFixedUpdate()); clear = false; yield break; } if (textNumber == 0) { finished = false; switch (bubbleType) { case Bubbles.Normal: bubble = transform.GetChild(0).GetChild(0).gameObject; bubble.SetActive(true); GameObject pointer = bubble.transform.GetChild(0).gameObject; if (target == null) { //Zeige ins off: pointer.GetComponent <RectTransform>().anchoredPosition = new Vector2(-180, -25); pointer.transform.localRotation = Quaternion.Euler(0, 0, 110); } else { //zeige auf target: pointer.GetComponent <RectTransform>().anchoredPosition = Vector2.up * 90; //halte y-position float diff_x = target.transform.position.x - pointer.transform.position.x; pointer.transform.localPosition = new Vector3(diff_x * Camera.main.pixelWidth / (Camera.main.orthographicSize * 12), pointer.transform.localPosition.y); Vector2 diff = target.transform.position - pointer.transform.position; pointer.transform.eulerAngles = new Vector3(0, 0, Mathf.Rad2Deg * Mathf.Atan2(-diff.x, 3)); } anim = bubble.GetComponent <Animator>(); anim.Play("BlobIn"); break; case Bubbles.Shouting: bubble = transform.GetChild(1).GetChild(0).gameObject; bubble.SetActive(true); anim = bubble.GetComponent <Animator>(); anim.Play("Shake"); break; } } bubble.SetActive(true); text = bubble.transform.GetChild(bubble.transform.childCount - 1).GetComponent <Text>(); text.text = ""; text.fontSize = fontSize; float realSpeed = textSpeed > 0 ? textSpeed / textToSay.Length : Time.fixedDeltaTime; int i = 0; while (i < textToSay.Length && ((Input.touchCount == 0 && !Input.GetMouseButton(1) && !menu.decisionMade) || autoPlay)) { text.text += textToSay[i++]; yield return(new WaitForSeconds(realSpeed)); } for (int j = i; j < textToSay.Length; j++) { text.text += textToSay[j]; } if (i != textToSay.Length) { yield return(new WaitUntil(() => Input.touchCount == 0 && !Input.GetMouseButton(1))); } yield return(new WaitUntil(() => ((Input.touchCount > 0 || Input.GetMouseButton(1) || autoPlay) && !pauseGame) || clear || menu.decisionMade)); if (clear) { yield return(new WaitForFixedUpdate()); clear = false; textNumber = -1; } else if (autoPlay) { yield return(new WaitForSeconds(textSpeed)); } else { yield return(new WaitUntil(() => Input.touchCount == 0 && !Input.GetMouseButton(1))); } if (textNumber + 1 == textBeforeCall) { textBeforeCall = 0; activeText = 0; turnOff = true; anim.Play("BlobOut"); yield return(new WaitForSeconds(.5f)); bubble.SetActive(false); finished = true; turnOff = false; } else { activeText++; } yield break; }
private void Start() { _bubbles = FindObjectOfType <Bubbles>(); _delay = Random.Range(.3f, 1.3f); }