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; }
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; }