Beispiel #1
0
        IEnumerator MovingHook(float downSpeed, float upSpeed)
        {
            while (-transform.position.x > leftBottonCorner.x && -transform.position.x < rightBottomCorner.x && -transform.position.y < leftBottonCorner.y)
            {
                yield return(null);

                if (SwampFishingGameManager.existingInstance.gameState != GameState.paused)
                {
                    transform.Translate(targetdirection * downSpeed * Time.deltaTime);
                }
            }
            currentHookStatus = hookMovingStatus.movingUp;
            while (Vector3.Distance(transform.position, CableStartPoint.position) > defaultLength)
            {
                yield return(null);

                if (SwampFishingGameManager.existingInstance.gameState != GameState.paused)
                {
                    transform.Translate(targetdirection * (-upSpeed / weightMultiplier) * Time.deltaTime);
                }
            }
            UpdateScore();
            weightMultiplier = 1;
            if (currentHookStatus != hookMovingStatus.breaking)
            {
                currentHookStatus = hookMovingStatus.rotating;
            }
        }
Beispiel #2
0
        public IEnumerator MoveHookUpwardsAfterHookFallen()
        {
            float hookSpeed          = 10; // speed to pull string when hook fallen down
            float waitingForGameover = 2;

            collectibleCatched = false;
            currentHookStatus  = hookMovingStatus.breaking;
            this.GetComponent <SpriteRenderer> ().enabled = false;
            this.GetComponent <BoxCollider2D> ().enabled  = false;


            GameObject hook = (GameObject)Instantiate(fallingHook);

            hook.transform.position = transform.position;
            hook.transform.rotation = transform.rotation;
            Destroy(hook, 4);

            while (Vector3.Distance(transform.position, CableStartPoint.position) > defaultLength)
            {
                yield return(null);

                transform.Translate(targetdirection * (-hookSpeed / weightMultiplier) * Time.deltaTime);
            }
            yield return(new WaitForSeconds(waitingForGameover));

            SwampFishingGameManager.existingInstance.GameOver(GameOverReason.badItemCollected);
        }
Beispiel #3
0
 void ResetHookData()
 {
     collectibleCatched = false;
     currentHookStatus  = hookMovingStatus.rotating;
     weightMultiplier   = 1;
     if (collectedItemInHook != null)
     {
         Destroy(collectedItemInHook);
     }
 }
Beispiel #4
0
 void OnHookDown(float downSpeed, float upSpeed)
 {
     currentHookStatus = hookMovingStatus.movingDown;
     SetPosition();
     StartCoroutine(MovingHook(downSpeed, upSpeed));
 }