public static void FireBallCrush(object sender, BallCrushedEventArgs e) { if (EventSystem.OnBallCrush != null) { EventSystem.OnBallCrush(sender, e); } }
public void IncCurrentBall(object sender, BallCrushedEventArgs e) { /*TODO: research on invoking using reflection, probably it will be much more efficient to use enums to invoke methods with special naming rules using parts of enum [On<EnumName>Action(object, EventArgs)]*/ switch (e.CrushReasons) { case BallCrushReasons.EnenmyBackWallCrush: break; // vs mode case BallCrushReasons.PlayerBackWallCrush: this.IncBallNum(sender, e); break; case BallCrushReasons.UnknownReason: break; } }
protected void IncBallNum(object sender, BallCrushedEventArgs e) { if (this.currentBall <= this.totalBalls) { ++this.currentBall; InterfaceUpdateEventArgs ev = new InterfaceUpdateEventArgs(InterfaceUpdateReasons.BallLost, string.Empty); EventSystem.FireInterfaceUpdate(this, ev); } else { object snd = new object(); EndGameEventArgs ev = new EndGameEventArgs(this.highScore, this.playerName, this.currentLevel, EndGameReasons.WastedAllBalls); EventSystem.FireEndGame(snd, ev); // TODO: eventsystem game end event } }
public void BallCrush(string collisionObjectName) { Transform plateTransform = GameObject.Find("Platform").transform; GameObject ballObj = GameObject.Find(collisionObjectName); ballObj.GetComponent<Rigidbody>().velocity = Vector3.zero; ballObj.GetComponent<Rigidbody>().angularVelocity = Vector3.zero; Vector3 newBallPosition = new Vector3(plateTransform.position.x, 0.25f, plateTransform.position.z + 0.2f); ballObj.transform.position = newBallPosition; ballObj.transform.eulerAngles = Vector3.zero; PlatformMover pm = GameObject.Find("Platform").GetComponent<PlatformMover>(); pm.Launched = false; object sender = new object(); BallCrushedEventArgs e = new BallCrushedEventArgs(BallCrushReasons.PlayerBackWallCrush, 0); EventSystem.FireBallCrush(sender, e); }
public void BallCrush(string collisionObjectName) { Transform plateTransform = GameObject.Find("Platform").transform; GameObject ballObj = GameObject.Find(collisionObjectName); ballObj.GetComponent <Rigidbody>().velocity = Vector3.zero; ballObj.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; Vector3 newBallPosition = new Vector3(plateTransform.position.x, 0.25f, plateTransform.position.z + 0.2f); ballObj.transform.position = newBallPosition; ballObj.transform.eulerAngles = Vector3.zero; PlatformMover pm = GameObject.Find("Platform").GetComponent <PlatformMover>(); pm.Launched = false; object sender = new object(); BallCrushedEventArgs e = new BallCrushedEventArgs(BallCrushReasons.PlayerBackWallCrush, 0); EventSystem.FireBallCrush(sender, e); }