示例#1
0
 public static void FireBallCrush(object sender, BallCrushedEventArgs e)
 {
     if (EventSystem.OnBallCrush != null)
     {
         EventSystem.OnBallCrush(sender, e);
     }
 }
示例#2
0
 public static void FireBallCrush(object sender, BallCrushedEventArgs e)
 {
     if (EventSystem.OnBallCrush != null)
     {
         EventSystem.OnBallCrush(sender, e);
     }
 }
示例#3
0
    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;
        }
    }
示例#4
0
 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
     }
 }
示例#5
0
    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);
    }
示例#6
0
    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);
    }
示例#7
0
 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
     }
 }
示例#8
0
 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;
     }
 }