コード例 #1
0
 public void BallSetPosition(Vector2 koord, BallPoint position)
 {
     _ballView.Ball.anchoredPosition = koord;
     _xPositinon = position.X;
     _yPosition  = position.Y;
     _isChanged  = true;
 }
コード例 #2
0
 public GenerateBalls(BallPoint sizePole, MiningSceneViewDescription miningViewDescription, BallPool ballPool)
 {
     _sizeGamePole          = sizePole;
     _typeBallResource      = miningViewDescription.TypeBallResource;
     _countColor            = miningViewDescription.Balls.Count;
     _percentageResources   = miningViewDescription.PercentageResources;
     _resources             = new ResourcesCount(miningViewDescription.TypeResources, miningViewDescription.CountResource);
     _miningViewDescription = miningViewDescription;
     _ballPool = ballPool;
 }
コード例 #3
0
        public BallController[,] GenerateAll()
        {
            _balls            = new BallController[_sizeGamePole.X, _sizeGamePole.Y];
            _generatePosition = new BallPoint(0, 0);

            do
            {
                _balls[_generatePosition.X, _generatePosition.Y] = NextBall();
            } while (NextPosition());
            return(_balls);
        }
コード例 #4
0
        public BallController GenerateRandomBall(BallPoint position)
        {
            List <TypeBall> ballsTypes = GetTypesBall();
            var             indexColor = _rand.Next(0, ballsTypes.Count);
            TypeBall        typeBall   = ballsTypes[indexColor];
            ResourcesCount  resources  = null;

            if (typeBall == _typeBallResource)
            {
                float chance = _rand.Next(0, 100) / 100F;
                if (chance < _percentageResources)
                {
                    resources = _resources;
                }
            }
            return(new BallController(_ballPool.FreeBall, position, typeBall, resources));
        }
コード例 #5
0
        private bool NextPosition()
        {
            int x = _generatePosition.X + 1;

            if (x < _sizeGamePole.X)
            {
                _generatePosition = new BallPoint(x, _generatePosition.Y);
                return(true);
            }
            else
            {
                int y = _generatePosition.Y + 1;
                if (y < _sizeGamePole.Y)
                {
                    x = 0;
                    _generatePosition = new BallPoint(x, y);
                    return(true);
                }
            }
            return(false);
        }
コード例 #6
0
 public CheckBall(BallPoint sizeGamePole)
 {
     _sizeGamePole = sizeGamePole;
 }
コード例 #7
0
 public void BallSetPosition(BallPoint position)
 {
     _xPositinon = position.X;
     _yPosition  = position.Y;
     _isChanged  = true;
 }
コード例 #8
0
 public BallController(BallView ballView, BallPoint position, TypeBall typeBall, ResourcesCount typeResources) : this(ballView, position.X, position.Y, typeBall, typeResources)
 {
 }
コード例 #9
0
 public MoveReverce(BallController ball)
 {
     _ball      = ball;
     _ballkoord = ball.View.Ball.anchoredPosition;
     _ballPoint = ball.Positinon;
 }