private IEnumerator RunTankRoutine()
        {
            // Call the main method
            TankMain();

            // Process all tank tasks in order
            while (tankTasks.Count > 0)
            {
                // Check for a crash
                if (crash == true)
                {
                    Debug.Log("Crashed!");
                    tankTasks.Clear();
                    yield break;
                }

                // Get an item
                TankEvent e = tankTasks.Dequeue();

                switch (e.eventType)
                {
                case TankEventType.Move:
                {
                    // Move the tank
                    yield return(StartCoroutine(MoveRoutine(e.eventValue)));

                    break;
                }

                case TankEventType.Rotate:
                {
                    // Rotate the tank
                    yield return(StartCoroutine(RotateRoutine(e.eventValue)));

                    break;
                }

                case TankEventType.Shoot:
                {
                    yield return(StartCoroutine(ShootRoutine()));

                    break;
                }
                }
            }
        }
예제 #2
0
        private IEnumerator RunTankRoutine()
        {
            // Call the main method
            TankMain();
            Debug.Log("Ddddddd" + tank);

            if (tank.y != yy)
            {
                yield return(StartCoroutine(MoveRoutine(tank.y)));

                tank.y = yy;
            }

            if (tank.x != xx)
            {
                yield return(StartCoroutine(HorizontalMoveRoutine(tank.x)));

                tank.x = xx;
            }


            //transform.Translate(tank);
            //transform.position = Vector2.MoveTowards(transform.position, tank, 2);

            // Process all tank tasks in order

            while (tankTasks.Count > 0)
            {
                // Check for a crash
                if (crash == true)
                {
                    Debug.Log("Crashed!");
                    tankTasks.Clear();
                    buttonPlayimg.sprite = playBuSprite;
                    yield break;
                }

                // Get an item
                TankEvent e = tankTasks.Dequeue();

                switch (e.eventType)
                {
                case TankEventType.Move:
                {
                    // Move the tank
                    yield return(StartCoroutine(MoveRoutine(e.eventValue)));

                    break;
                }

                case TankEventType.HorizonMove:
                {
                    // Move the tank
                    yield return(StartCoroutine(HorizontalMoveRoutine(e.eventValue)));

                    break;
                }

                case TankEventType.Rotate:
                {
                    // Rotate the tank
                    yield return(StartCoroutine(RotateRoutine(e.eventValue)));

                    break;
                }

                case TankEventType.Shoot:
                {
                    yield return(StartCoroutine(ShootRoutine(e.eventValue)));

                    break;
                }
                }
            }



            buttonPlayimg.sprite = playBuSprite;

            //transform.Translate(new Vector3(0, 0, 0));
        }