public void ShootBall() { if (MoveState == ePlayerState.Move) { return; } _instArrow.transform.localScale = new Vector3(0, 0, 0); isClickOn = false; Vector2 direction = _instArrow.transform.rotation * new Vector2(1, 0.0f) * _powerSize; BasketBallGame.BasketBall ball = _ballFactory.Get() as BasketBallGame.BasketBall; ball.ShotToTarget(direction); ball.Activate(transform.position, BasketBallGame.EBallOwner.LeftPlayer, "Ball"); ball.destroyed += OnBallDestroyed; if (!NetworkManager.Instance.IsSinglePlay()) { NetworkManager.Instance.SendRequestFireBall(_powerSize, direction.x, direction.y); } _powerSize = 0.0f; }
public void ShootBall() { Vector2 direction = directionArrow.transform.rotation * new Vector2(aiFireSpeed, 0.0f) * _powerSize; _powerSize = 0.0f; BasketBall ball = _ballFactory.Get() as BasketBall; ball.Activate(transform.position, EBallOwner.RightPlayer, "AIBall"); ball.ShotToTarget(direction); ball.destroyed += OnBallDestroyed; }
public void ShootBallAuto() { isClickOn = false; Vector2 direction = _instArrow.transform.rotation * new Vector2(1, 0.0f) * _powerSize; _powerSize = 0.0f; BasketBallGame.BasketBall ball = _ballFactory.Get() as BasketBallGame.BasketBall; ball.ShotToTarget(direction); ball.Activate(transform.position, BasketBallGame.EBallOwner.AI, "AIBall"); ball.destroyed += OnBallDestroyed; }
void OnTriggerExit2D(Collider2D collision) { collision.transform.SetParent(null); if (collision.transform.CompareTag("Ball")) { --LeftBallCount; leftText.text = LeftBallCount.ToString(); } if (collision.transform.CompareTag("AIBall")) { --RightBallCount; rightText.text = RightBallCount.ToString(); } BasketBall basket = collision.GetComponent <BasketBall>(); basket.SetActiveTraill(true); }
public void ShootBall(float power, float angleX, float angleY) { if (MoveState == ePlayerState.Move) { return; } //Vector2 direction = _instArrow.transform.rotation * new Vector2(1, angleY) * power; Vector2 direction; direction.x = angleX; direction.y = angleY; BasketBallGame.BasketBall ball = _ballFactory.Get() as BasketBallGame.BasketBall; ball.ShotToTarget(direction); ball.Activate(transform.position, BasketBallGame.EBallOwner.LeftPlayer, "Ball"); ball.destroyed += OnBallDestroyed; }
void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.CompareTag("Ball")) { ++LeftBallCount; leftText.text = LeftBallCount.ToString(); AudioManager.Instance.PlaySound(eSoundId.Score); goalInEffectPrefab.PlayEffect(collision.transform); } else if (collision.transform.CompareTag("AIBall")) { ++RightBallCount; rightText.text = RightBallCount.ToString(); AudioManager.Instance.PlaySound(eSoundId.Score); goalInEffectPrefab.PlayEffect(collision.transform); } BasketBall basket = collision.GetComponent <BasketBall>(); basket.SetActiveTraill(false); }
void OnBallDestroyed(BasketBall usedBall) { usedBall.destroyed -= OnBallDestroyed; _ballFactory.Restore(usedBall); }
void OnBallDestroyed(BasketBallGame.BasketBall usedBall) { //To Do: 게임매니저로 옮겨서 플레이어로 이어주도록 해야함. usedBall.destroyed -= OnBallDestroyed; _ballFactory.Restore(usedBall); }