コード例 #1
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;
 }
コード例 #2
0
 public BallController(BallView ballView, int xPositinon, int yPosition, TypeBall typeBall, ResourcesCount typeResources)
 {
     _ballView      = ballView;
     _xPositinon    = xPositinon;
     _yPosition     = yPosition;
     _typeBall      = typeBall;
     _typeResources = typeResources;
     _moveAnimator  = _ballView.MoveAnimator;
     _ballView.PointerObject.BallMoveSide += PointerObject_BallMoveSide;
     _ballView.MoveAnimator.EndAnimation  += OnEndAnimation;
     _isChanged = true;
 }
コード例 #3
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));
        }
コード例 #4
0
        public BallController GenerateBall(List <TypeBall> ballsTypes)
        {
            var      indexColor = _rand.Next(0, ballsTypes.Count);
            TypeBall typeBall   = ballsTypes[indexColor];

            ballsTypes.Remove(typeBall);
            ResourcesCount resources = null;

            if (typeBall == _typeBallResource)
            {
                float chance = _rand.Next(0, 100) / 100F;
                if (chance < _percentageResources)
                {
                    resources = _resources;
                }
            }
            return(new BallController(_ballPool.FreeBall, _generatePosition, typeBall, resources));
        }
コード例 #5
0
 public BallController(BallView ballView, BallPoint position, TypeBall typeBall, ResourcesCount typeResources) : this(ballView, position.X, position.Y, typeBall, typeResources)
 {
 }