public void Tick(int frame)
        {
            primarySprite.position = GameScreenCoords.CellToWorld(cellPos);

            if (frame == 4)
            {
                if (cellPos.x == 0)
                {
                    cellPos.x = 30;
                    if (cellPos.y + 3 > 23)
                    {
                        if (cellPos.y + 3 == 24) {
                            cellPos.y = 27;
                            cellPos.x = 21;
                        }
                        else if (cellPos.y == 27)
                            cellPos.y = 3;
                    }
                    else
                        cellPos.y += 3;
                }
                else
                    cellPos.x--;
            }
        }
        public override void Tic(int frame)
        {


            AvatarCtrl.Instance.primaryAnimator.Play(0, 0, ((frame - 1) / 3.0f));

            tempV3 = GameScreenCoords.CellToWorld(AvatarCtrl.Instance.cellPosition);
            tempV3.x += GameScreenCoords.subUnit * (frame - 1);
            AvatarCtrl.Instance._transform.position = tempV3;

            if (frame == 4)
            {

                if (AvatarCtrl.Instance.cellPosition.x + 1 == 31)
                {
                    AvatarCtrl.Instance.cellPosition.x = 0;
                    AvatarCtrl.Instance._transform.position = GameScreenCoords.CellToWorld(AvatarCtrl.Instance.cellPosition);
                }
                else
                {
                    AvatarCtrl.Instance.cellPosition.x += 1;

                    AvatarCtrl.Instance._transform.position = GameScreenCoords.CellToWorld(AvatarCtrl.Instance.cellPosition);
                }
            }
        }
Exemple #3
0
 private void GenerateLines()
 {
     for(int i = 0; i < 8; i++)
     {
         lines[i] = Instantiate(linesPrefab).transform;
         lines[i].localScale = new Vector3(  GameScreenCoords.Units * 16f,
                                             GameScreenCoords.Units * 1,1);
         lines[i].position = GameScreenCoords.CellToWorld(0, (i * 3) + 3);
     }
 }
        public void ResetAvatar()
        {
            Instance.actualState = States.other;
            Instance.Standing();

            GameMgr_JJ.Instance.MultiplyTickDelay(1);

            cellPosition = _InitialPosition;
            SetSize();
            _transform.position = GameScreenCoords.CellToWorld(14,0);
            actualKickedFrames = 0;
        }
        public override void Tic(int frame)
        {
            if (frame == 1)
            {
                AvatarCtrl.Instance.primaryAnimator.SetInteger(AvatarCtrl.stateName, (int)AvatarCtrl.States.Falling);
                GameMgr_JJ.Instance.MultiplyTickDelay(10f);


                AvatarCtrl.Instance.AddKickedFrames(40); // 2.93sec
            }

            AvatarCtrl.Instance.primaryAnimator.Play(0, 0, ((frame -1) / 3.0f));

            if (frame == 4)
            {
                AvatarCtrl.Instance.cellPosition.y -= 3;
                GameMgr_JJ.Instance.MultiplyTickDelay(1f);

                AvatarCtrl.Instance.KnockOut();
                AvatarCtrl.Instance._transform.position = GameScreenCoords.CellToWorld(AvatarCtrl.Instance.cellPosition);
            }
        }
        public void Tic(int frame)
        {
            tempV3 = GameScreenCoords.CellToWorld(cellPos);
            tempV3.x += GameScreenCoords.subUnit * (frame - 1) * moveDirection;
            primarySprite.position = tempV3;
            
            if (frame == 4)
            {

                if (moveDirection == 1)
                {
                    if (cellPos.x == 30)
                    {
                        cellPos.x = 0;
                        if (cellPos.y - 3 < 3)
                            cellPos.y = 24;
                        else
                            cellPos.y -= 3;
                    }
                    else
                        cellPos.x++;
                }
                else
                {
                    if (cellPos.x == 0)
                    {
                        cellPos.x = 30;
                        if (cellPos.y + 3 > 24)
                            cellPos.y = 3;
                        else
                            cellPos.y += 3;
                    }
                    else
                        cellPos.x--;
                }
            }

        }
        public override void Tic(int frame)
        {
            if (frame == 1)
            {
                AvatarCtrl.Instance.primaryAnimator.SetInteger(AvatarCtrl.stateName, (int)AvatarCtrl.States.Jumping);
                GameMgr_JJ.Instance.MultiplyTickDelay(10f);
            }

            AvatarCtrl.Instance.primaryAnimator.Play(0, 0, ((frameCount) / 7.0f));
            frameCount++;

            if (frame == 2)
                GameMgr_JJ.Instance.MultiplyTickDelay(5f);
            else if(frame == 5)
                GameMgr_JJ.Instance.MultiplyTickDelay(18f);

            //if (frame == 4)
            //{
            if (frameCount == 8)
                {
                    frameCount = 0;

                    GameMgr_JJ.Instance.MultiplyTickDelay(1f);

                    AvatarCtrl.Instance.cellPosition.y += 3;

                    AvatarCtrl.Instance._transform.position = GameScreenCoords.CellToWorld(AvatarCtrl.Instance.cellPosition);

                    AvatarCtrl.Instance.actualState = AvatarCtrl.States.other;
                    AvatarCtrl.Instance.Standing();

                }
                //else
                //{
                //}
            //}
        }
 public void UpdatePos(int cell, int line)
 {
     primarySprite.transform.position = GameScreenCoords.CellToWorld(cell, line);
 }