Beispiel #1
0
 void Awake()
 {
     _cell.ColorsSprite       = _colorsSprite;
     _cell.NumbersSprite      = _numbersSprite;
     _cell.InstanseGameObject = _instanseGameObject;
     _cell.NumberGameObject   = _numberGameObject;
     _cell.ColorGameObject    = _colorGameObject;
     logic = new BaseGameLogic(_maxDepth, _size);
 }
Beispiel #2
0
 void Awake()
 {
     _cell.ColorsSprite = _colorsSprite;
     _cell.NumbersSprite = _numbersSprite;
     _cell.InstanseGameObject = _instanseGameObject;
     _cell.NumberGameObject = _numberGameObject;
     _cell.ColorGameObject = _colorGameObject;
     logic = new BaseGameLogic(_maxDepth, _size);
 }
Beispiel #3
0
            private IEnumerator Pattern_CirclePendulum_Draw(byte[,] pattern, float patternSpace, int waitEndFrame)
            {
                const int interval = 8;
                Vector2 patternCenterPos = new Vector2(0.0f, 0.0f);
                const float speed1 = 0.01f; // 목표지점까지 날아가는 속도
                const float speed2 = 0.025f; // 정지 종료 후 밖으로 날아가는 속도
                const string shape = "Common/Bullet_Red";

                int row = pattern.GetLength(0);
                int col = pattern.GetLength(1);
                List<Vector2Int> indexes = new List<Vector2Int>();

                for (int r = 0; r < row; ++r)
                {
                    for (int c = 0; c < col; ++c)
                    {
                        if (pattern[r, c] != 0)
                        {
                            indexes.Add(new Vector2Int(r, c));
                        }
                    }
                }

                // indexes 랜덤하게 섞기
                BaseGameLogic.Shuffle(indexes);

                int waitEndAbsFrame = _Frame + waitEndFrame;
                // 좌표계 우상단이 (+, +)
                float patternWidth = patternSpace * (col - 1);
                float patternHeight = patternSpace * (row - 1);
                Vector2 patternLeftTopPos = new Vector2(patternCenterPos.x - (patternWidth / 2.0f), patternCenterPos.y + (patternHeight / 2.0f));

                foreach (var patternIndex in indexes)
                {
                    // 목표 지점
                    int r = patternIndex.x;
                    int c = patternIndex.y;
                    Vector2 targetPos = patternLeftTopPos + new Vector2(c * patternSpace, r * -patternSpace);

                    // 현재 위치에서 발사한 탄이 목표지점에 도달하기까지 걸리는 시간
                    int moveDuration = (int)(Vector2.Distance(_pos, targetPos) / speed1);

                    // 목표 지점 도달 후 정지 해 있을 시간
                    int stopDuration = waitEndAbsFrame - (_Frame + moveDuration);

                    // 정지 종료 후 패턴 중앙의 반대방향으로
                    float angle2 = BaseGameLogic.CalcluatePointToPointAngle(patternCenterPos, targetPos);

                    PosPlacedBullet b = GameSystem._Instance.CreateBullet<PosPlacedBullet>();
                    b.Init(shape, _pos.x, _pos.y, targetPos, speed1, 0.0f, moveDuration, stopDuration, angle2, 0.0f, speed2, 0.0f);

                    yield return new WaitForFrames(interval);
                }
            }