public bool CheckForRepeats() { bool del = false; //List<int> ids = new List<int> (); if (SameColor.Count < 2) { return(false); } try{ BasketBall ball = SameColor [0].GetComponent <BasketBall> (); if (ball != null) { int first = ball.id; //ids.Add (first); foreach (GameObject g in SameColor) { BasketBall b = g.GetComponent <BasketBall> (); if (b.id != first) { del = true; } } } } catch { } return(del); }
public void TestMakeBasketBall() { Ball ball = new BasketBall(1, 1); Assert.AreEqual(1, ball.getRadian(), "ball radian is 1"); Assert.AreEqual(1, ball.getVelocity(), "ball velocity is 1"); }
private void Awake() { ball = GameObject.FindObjectOfType <BasketBall>(); padle = GameObject.FindObjectOfType <PaddleScript>(); levelmenager = GameObject.FindObjectOfType <LevelManager>(); sound = GameObject.FindObjectOfType <SoundManager>(); livep = GameObject.FindObjectOfType <LivePicture>(); }
public void TestRightSideCollision() { Ball ball = new BasketBall(0, 20, new Point(513, 0)); Assert.IsFalse(ball.rightCollision(), "이동 전"); ball.move(); Assert.IsTrue(ball.rightCollision(), "이동 후"); }
public void TestGetYfactor() { Ball ball = new BasketBall(1, 20); double exptected = Math.Sin(1) * 20; Assert.AreEqual(exptected, ball.getYfactor()); }
public void TestTopSideCollision() { Ball ball = new BasketBall(Math.PI / 2, 20, new Point(0, 20)); Assert.IsFalse(ball.topCollision(), "이동 전"); ball.move(); Assert.IsTrue(ball.topCollision(), "이동 후"); }
public void TestLeftSideCollision() { Ball ball = new BasketBall(Math.PI, 20, new Point(30, 0)); Assert.IsFalse(ball.leftCollision(), "이동 전"); ball.move(); Assert.IsTrue(ball.leftCollision(), "이동 후"); }
public void TestBottomSideCollision() { Ball ball = new BasketBall(Math.PI * 3 / 2, 20, new Point(0, 300)); Assert.IsFalse(ball.bottomCollision(), "이동 전"); ball.move(); Assert.IsTrue(ball.bottomCollision(), "이동 후"); }
void OnCollisionEnter2D(Collision2D coll) { //int count = 0; bool already = false; //bool alreadycolor = false; foreach (GameObject g in CollidingBalls) { if (g == coll.gameObject) { already = true; } } if (already == false) { CollidingBalls.Add(coll.gameObject); foreach (GameObject g in CollidingBalls) { if (g != null) { BasketBall ball = g.GetComponent <BasketBall> (); if (ball != null) { if (ball.color == color) { //foreach(GameObject gg in SameColor){ // if(gg == ball.gameObject){ // alreadycolor = true; // } //} //if(alreadycolor == false){ SameColor.Add(ball.gameObject); } } } } } }
// Use this for initialization void Start() { player = FindObjectOfType <Movement>(); ball = FindObjectOfType <BasketBall>(); if (textfile != null) { textLines = (textfile.text.Split('\n')); } if (endAtLine == 0) { endAtLine = textLines.Length - 1; } if (isActive) { EnableTextBox(); } else { DisableTextBox(); } }
public void TestRightReflect() { Ball ball = new BasketBall(0, 20, new Point(513, 0)); Assert.IsFalse(ball.collision(), "이동 전"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후"); ball = new BasketBall(Math.PI / 4, 20, new Point(513, 150)); Assert.IsFalse(ball.collision(), "이동 전2"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전2"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후2"); ball = new BasketBall(Math.PI * 7 / 4, 20, new Point(513, 150)); Assert.IsFalse(ball.collision(), "이동 전3"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전3"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후3"); }
public void TestLeftReflect() { Ball ball = new BasketBall(Math.PI, 20, new Point(30, 0)); Assert.IsFalse(ball.collision(), "이동 전"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후"); ball = new BasketBall(Math.PI * 3 / 4, 40, new Point(30, 150)); Assert.IsFalse(ball.collision(), "이동 전2"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전2"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후2"); ball = new BasketBall(Math.PI * 5 / 4, 40, new Point(30, 150)); Assert.IsFalse(ball.collision(), "이동 전3"); ball.move(); Assert.IsTrue(ball.collision(), "충돌 전3"); ball.move(); Assert.IsFalse(ball.collision(), "충돌 후3"); }
public abstract void PlayBasketBall(BasketBall ballType);
public void GiveBasketBallLesson() { _basketBall = GetBasketBall(); // Lesson Stuff- work with ball }
public void GiveBasketBallLesson(BasketBall ball) { }
// Use this for initialization void Start() { SoccerBall = FindObjectOfType <BasketBall>(); test = true; }
public override void PlayBasketBall(BasketBall ballType) { Console.WriteLine("篮球是用来踢的"); }
public void UpdateGame(GameTime gameTime) { #region step a if (null != mFinal) //done { return; } #endregion step a #region steb b //hero movement : right thumb stic mHero.Update(InputWrapper.ThumbSticks.Right); //basketball for (int b = mBBallList.Count - 1; b >= 0; b--) { if (mBBallList[b].UpdateAndExplode()) { mBBallList.RemoveAt(b); mBBallMissed++; mScore += kBallMissedScore; } } #endregion step b #region step c for (int b = mBBallList.Count - 1; b >= 0; b--) { if (mHero.PrimitiveTouches(mBBallList[b])) { mBBallList.RemoveAt(b); mBBallHit++; mScore += kBallTouchScore; } } #endregion step c #region step d //check for new basketball condition TimeSpan timePassed = gameTime.TotalGameTime; timePassed = timePassed.Subtract(mCreationTimeSpan); if (timePassed.TotalMilliseconds > kBallMSecInterval) { mCreationTimeSpan = gameTime.TotalGameTime; BasketBall b = new BasketBall(); mTotalBallCreated++; mBBallList.Add(b); } #endregion stepd #region step e //check for winning condition ... if (mScore > kWinScore) { mFinal = new TexturedPrimitive("Winner", new Vector2(75, 50), new Vector2(30, 20)); } else if (mScore < kWinScore) { mFinal = new TexturedPrimitive("Loser", new Vector2(75, 50), new Vector2(30, 20)); } #endregion step e }