protected virtual void OnWallUpdated(WallEventArgs wall) { if (WallUpdated != null) { WallUpdated(this, wall); } }
public void Remove(float el) { int indexOfEl = IndexOf(el); if (indexOfEl != -1) { for (int i = indexOfEl; i < length - 1; i++) { try{ arr[i] = arr[i + 1]; }catch (IndexOutOfRangeException e) { Debug.Log("Error index " + i); } } arr[length - 1] = -100f; length--; Debug.Log("Removed element"); } WallEventArgs wall = new WallEventArgs(column, el, false); OnWallUpdated(wall); }
public void Add(float el) { arr[length++] = el; SortArray(arr); WallEventArgs wall = new WallEventArgs(column, el, true); OnWallUpdated(wall); }
public Array(int capacity, int column) { this.capacity = capacity; arr = new float[capacity]; for (int i = 0; i < capacity; i++) { arr[i] = -100f; } length = 0; this.column = column; wall = new WallEventArgs(column, 0f, false); }
void PlayerReachedWall(object sender, System.EventArgs e) { isPlayerTouchingWall = true; WallEventArgs args = (WallEventArgs)e; if (args.tag == "EndWall") { GlobalGameManager.player.transform.position = stageStartPosition.position + Vector3.right * 10; } if (args.tag == "StartWall") { GlobalGameManager.player.transform.position = stageEndPosition.position + Vector3.left * 10; } }
public void OnWallUpdated(object source, WallEventArgs wall) { //Debug.Log("Recognized Wall Updated " + wall.column + " " + wall.z + " " + wall.wallAdded); //Debug.Log("Pointed wall " + arr[wall.column].Peek(pointers[wall.column])); if (wall.wallAdded) { if (wall.z > arr[wall.column].Peek(pointers[wall.column])) { pointers[wall.column]++; } } if (!wall.wallAdded) { //Debug.Log("reached here"); if (wall.z > arr[wall.column].Peek(pointers[wall.column])) { //Debug.Log("reached inside, pointers[wall.column] : " + pointers[wall.column]); pointers[wall.column]--; //Debug.Log("after subtraction, pointers[wall.column] : " + pointers[wall.column]); } } }
public static void PlayerHitWall(object sender, WallEventArgs args) { OnPlayerHitWall(sender, args); }