} // End Unity method Awake private void OnCollisionEnter2D(Collision2D coll) { int otherLayer = coll.gameObject.layer; if (otherLayer == (int)Game.Layers.UFO) { Commentator.raiseEvent(CommentEvent.BallHitsPlayer); killMe(); } else if (otherLayer == (int)Game.Layers.Planets && coll.gameObject.name != "Sun") { Commentator.raiseEvent(CommentEvent.BallHitsPlanet); if (!bounceSound.isPlaying) { bounceSound.volume = Game.getSoundVolume(); bounceSound.Play(); } } else if (otherLayer == (int)Game.Layers.Hole) { int numStrokes = parentShip.getNumStrokes(); EventHandler.raiseEvent(GameEvent.LevelWon, numStrokes); if (numStrokes == 1) { Commentator.raiseEvent(CommentEvent.HoleInOne); } else { Commentator.raiseEvent(CommentEvent.LevelWon); } killMe(); } } // End Unity method OnCollisionEnter2D
// get refs at start private void Start() { commentator = _AudioMaster.inst.gameObject.transform.GetChild(1).GetComponent <Commentator>(); fire_particles = transform.Find("Particle_System_Fire").GetComponent <ParticleSystem>(); fire_particles.Play(); bomb = GetComponent <BombFlash>(); rb2 = GetComponent <Rigidbody2D>(); tr = GetComponent <TrailRenderer>(); trigger = GetComponent <CircleCollider2D>(); numbers = GameObject.FindGameObjectsWithTag("Numbers"); vis = transform.Find("Visual").gameObject; col = vis.GetComponent <CircleCollider2D>(); if (GameObject.FindGameObjectWithTag("MainCamera") != null) { cameraShake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>(); } start_pos = transform.position; orig_start_color = tr.startColor; orig_end_color = tr.endColor; timeToAnim = pauseAnimation; animRemaining = animTime; if (transform.Find("Zoom Collider") != null) { goalZoom = transform.Find("Zoom Collider").GetComponent <GoalZoom>(); } team_id = -1; if (Observer.Instance != null) { Observer.Instance.PickedUpBall(team_id); } }
} // End private Unity method OnMouseUp // Additional Methods private void fire(Vector2 shotVector) { GolfBall myBall = nextInPool(); if (myBall == null) { return; } incrementStrokes(); if (shotVector.sqrMagnitude > 0.99f) { ++consecutiveStrokesAtFullPower; if (consecutiveStrokesAtFullPower >= Commentator.FULL_POWER_STROKES_THRESHOLD) { Commentator.raiseEvent(CommentEvent.AlwaysFullPower); } } else { consecutiveStrokesAtFullPower = 0; } playLaunchClip(); myBall.launch(transform.position, shotVector * LAUNCH_POWER, this); Game.setState(Game.State.WaitingOnBall); } // End private method fire
} // End Unity method OnTriggerExit2D private void Update() { lifetime += Time.deltaTime; if (spaceshipCollisionsDisabled && lifetime > LAUNCH_COLLIDER_TIMEOUT) { enableSpaceshipCollisions(); } if (body2D.velocity.sqrMagnitude <= MIN_SQR_MAGNITUDE) { timeStopped += Time.deltaTime; if (timeStopped >= MAX_TIME_STOPPED) { Commentator.raiseEvent(CommentEvent.BallStops); killMe(); } } else { timeStopped = 0.0f; } if (lifetime >= MAX_LIFETIME) { Commentator.raiseEvent(CommentEvent.BallTimeout); killMe(); } } // End Unity method Update
} // End public method hideFirstRunScreen public void pauseGame() { Time.timeScale = 0.0f; pauseMenu.SetActive(true); Game.setState(Game.State.Paused); Commentator.raiseEvent(CommentEvent.GamePaused); } // End public method pauseGame
} // End Unity method OnMouseUpAsButton // Additional methods private void destroyMe() { effectsPool.playEffect(EffectsPool.Effect.PlanetDestroyed, transform.position, transform.localScale); gameObject.SetActive(false); EventHandler.raiseEvent(GameEvent.PlanetDestroyed); Commentator.raiseEvent(CommentEvent.PlanetDestroyed); } // End private method destroyMe
private void Start() { commentator = _AudioMaster.inst.gameObject.transform.GetChild(1).GetComponent <Commentator>(); if (SceneManager.GetActiveScene().name == "LAB_Ian2") { in_tutorial = true; } }
private void Commentreader() { ContextFactory cfact = new ContextFactory(); AggregatorDBContext adbcont = cfact.CreateDbContext(new string[] { "", "" }); ICollection <Comments> comments = new List <Comments>(); ICollection <Commentator> commentator = new List <Commentator>(); List <Blog> commentstore = adbcont.Blogs.ToList(); foreach (Blog b in commentstore) { string commentURL = b.CommentURL; var reader = XmlReader.Create(commentURL); var feed = SyndicationFeed.Load(reader); foreach (SyndicationItem comment in feed.Items) { Comments comment1 = new Comments(); ICollection <SyndicationLink> links = new List <SyndicationLink>(); links = comment.Links; foreach (SyndicationLink l in links) { comment1.Absuri = l.Uri.AbsoluteUri; break; } List <CommentatorComment> aa = new List <CommentatorComment>(); comment1.CommentatorsComments = aa; comment1.PCID = comment.Id; comment1.DateCommentPosted = comment.PublishDate.UtcDateTime; if (comment.Summary.Text.Length >= 1000) { comment1.CommentPosted = comment.Summary.Text.Substring(0, 999); } else { comment1.CommentPosted = comment.Summary.Text; } comment1.BlogID = b.BlogID; adbcont.Comments.Add(comment1); foreach (SyndicationPerson commentee in comment.Authors) { Commentator commentator1 = adbcont.commentators.FirstOrDefault(a => a.CommentatorName == commentee.Name && a.Commentatoremail == commentee.Email); CommentatorComment cc = new CommentatorComment(); if (commentator1 == null) { commentator1 = new Commentator(); commentator1.Commentatoremail = commentee.Email; commentator1.CommentatorName = commentee.Name; adbcont.commentators.Add(commentator1); cc.comments = comment1; cc.Commentators = commentator1; comment1.CommentatorsComments.Add(cc); } } adbcont.Comments.Add(comment1); adbcont.SaveChanges(); } } }
} // End private method getShotVector public void incrementStrokes(int numToIncrement = 1) { numStrokes += numToIncrement; EventHandler.raiseEvent(GameEvent.StrokeTaken, numStrokes); if (numStrokes >= Commentator.MANY_STROKES_THRESHOLD) { Commentator.raiseEvent(CommentEvent.ManyStrokes); } } // End public method incrementStrokes
public PlayingState(AFighter firstFighter, AFighter secondFighter) { _fighters.Add(firstFighter); _fighters.Add(secondFighter); _fighters = _fighters.OrderByDescending(y => y.Initiative).ThenBy(y => y.AttackValue).ToList(); AFighter.FighterDied += this.OnEndGame; _commentator = new Commentator(); }
} // End private Unity method OnDrawGizmos private void OnMouseDown() { if (Game.getState() == Game.State.Running && !liningUpShot) { liningUpShot = true; Vector2 shotVector = getShotVector(); targetingReticule.gameObject.SetActive(true); setTargetingReticule(shotVector); Commentator.raiseEvent(CommentEvent.LiningUpShot); } // End if we are able to select a target } // End private Unity method OnMouseDown
} // End private method setTargetingReticule private IEnumerator warpCoroutine(Vector2 newPos) { yield return(new WaitForSeconds(WARP_DELAY)); if (Vector2.Distance(newPos, (Vector2)transform.position) < Commentator.SHORT_WARP_DISTANCE_THRESHOLD) { Commentator.raiseEvent(CommentEvent.ShortWarp); } warpEffect.SetActive(true); playWarpClip(); yield return(new WaitForSeconds(WARP_DELAY)); transform.position = (Vector3)newPos; } // End private coroutine method warpCoroutine
} // End public method beginCommentVolume public void endCommentVolume() { float currentCommentVolume = commentVolumeSlider.value; if (currentCommentVolume > prevCommentVolume) { Commentator.raiseEvent(CommentEvent.CommentsTurnedUp); } else if (currentCommentVolume < prevCommentVolume) { Commentator.raiseEvent(CommentEvent.CommentsTurnedDown); } prevCommentVolume = currentCommentVolume; endVolumeChange(); } // End public method endCommentVolume
public void Write(Commentator commentator) { if (commentator == null) { throw new ArgumentNullException(nameof(commentator)); } var document = new Document(); document.AddObject(commentator); IndexWriter indexWriter = IndexWriterProvider.GetIndexWriter(); indexWriter.AddDocument(document); }
IEnumerator Countdown(int playerID) { while (currentCount > 0.0f) { yield return(new WaitForSecondsRealtime(1.0f)); currentCount -= 1.0f; // Update text respawnCountdown.text = currentCount.ToString(); } Commentator c = _AudioMaster.inst.gameObject.transform.GetChild(1).GetComponent <Commentator>(); c.Comment(Commentator.Trigger.Spawn, true); _PlayerManager.Instance.players[playerID].SetActive(true); Destroy(gameObject); }
} // End public method inScreenBounds public void killMe() { effectsPool.playEffect(EffectsPool.Effect.BallExplosion, transform.position); if (inScreenBounds()) { Vector2 closestPosition = calcNearestWarp(); parentShip.warpToPosition(closestPosition); } else { EventHandler.raiseEvent(GameEvent.BallOutOfBounds); Commentator.raiseEvent(CommentEvent.BallOutOfBounds); } Game.setState(Game.State.Running); gameObject.SetActive(false); } // End public method killMe
public virtual void lose_ball(Vector2 vel, bool sameTeam) { if (sameTeam) { return; } stacker.PlaySound(tackleSound, 1); // get camera zoom GameObject cameraZoomGO = GameObject.FindGameObjectWithTag("MainCamera"); if (cameraZoomGO != null) { cameraZoom = cameraZoomGO.GetComponent <CameraZoom>(); cameraZoom.ZoomIn(gameObject, lose_ball_zoom_time, slow_down_rate); } else { //Debug.Log("Tutorial_Cam: " + tutorial_cam.name); cameraZoom = tutorial_cam.GetComponent <CameraZoom>(); //cameraZoom.ZoomIn(gameObject, lose_ball_zoom_time, slow_down_rate); } has_ball = false; charging = false; ball.transform.parent = null; ball.GetComponent <Ball_Behavior>().dropped(); ball.GetComponent <Rigidbody2D>().velocity = vel; StartCoroutine(ball.GetComponent <Ball_Behavior>().BallNoGrab(1f)); // Debug.Log("Ball velocity: " + ball.GetComponent<Rigidbody2D>().velocity); ball = null; GetStunned(); Commentator c = _AudioMaster.inst.gameObject.transform.GetChild(1).GetComponent <Commentator>(); c.Comment(Commentator.Trigger.Tackle, true); // Debug.Log(gameObject.name + ": DISPOSSESSED!!!"); }
// Unity methods private void Start() { Commentator.setObserver(this); source = GetComponent <AudioSource>(); } // End Unity method Start
} // End public static method refreshVolume public static void setObserver(Commentator my) { observer = my; } // End public static method setObserver
public bool TryGet(string commentatorCode, out Commentator commentator) { EnsureData(); return(CommentatorByCode.TryGetValue(commentatorCode, out commentator)); }
public static void Intro() { Commentator commentator = new Commentator(); Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╗\n"); Console.WriteLine("{0,25} {1, 16}", "[ RPG Fight ]", "║\n"); Console.WriteLine("═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╝\n\n\n"); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("First character's name: "); string name1 = Console.ReadLine(); Console.WriteLine("\n\nFirst character's class:\n"); Console.WriteLine("1. Warrior"); Console.WriteLine("2. Wizard"); Character charA; if (Input(ConsoleKey.NumPad1, ConsoleKey.NumPad2)) { Warrior war = new Warrior(name1); commentator.Link(war); charA = war; } else { Wizard wiz = new Wizard(name1); commentator.Link(wiz); charA = wiz; } Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╗\n"); Console.WriteLine("{0,25} {1, 16}", "[ RPG Fight ]", "║\n"); Console.WriteLine("═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╝\n\n\n"); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("Second character's name: "); string name2 = Console.ReadLine(); Console.WriteLine("\n\nSecond character's class:\n"); Console.WriteLine("1. Warrior"); Console.WriteLine("2. Wizard"); Character charB; if (Input(ConsoleKey.NumPad1, ConsoleKey.NumPad2)) { Warrior war = new Warrior(name2); commentator.Link(war); charB = war; } else { Wizard wiz = new Wizard(name1); commentator.Link(wiz); charB = wiz; } Fight(charA, charB); }
public CommentatorAndCommentary(Commentator commentator, Commentary commentary) { Commentator = commentator; Commentary = commentary; }