예제 #1
0
    private void StartGame()
    {
        fadeAnimator.onFadeFinished -= StartGame;
        //fadeAnimator.gameObject.SetActive (false);

        cameraManager.transform.position          = cameraOrigPos;
        cameraManager.thisCamera.orthographicSize = cameraOrigZoom;

        preScene.SetActive(false);
        gameScene.SetActive(true);

        foreach (var n in npcs)
        {
            if (n && n.gameObject.activeInHierarchy)
            {
                n.SetMovement(true);
            }
        }

        playerController.SetMovement(true);


        foreach (var b in backgrounds)
        {
            b.StartMovement();
        }

        cameraManager.StartFollow();

        textAnimator.onTextAnimationFinished += NextText;
        textAnimator.Show();
        textAnimator.AnimateText("Ok boys, this is it. Give it your all.");
    }
예제 #2
0
    void Update()
    {
        if (playerReached)
        {
            return;
        }

        if (!shieldsDown && !playerFound && Mathf.Abs(playerController.transform.position.x - transform.position.x) < distanceFromPlayer)
        {
            playerFound = true;

            text.onTextAnimationFinished += StartBoss;
            text.Show();
            text.AnimateText("This is what we've been training for. Full speed ahead!");
            gun.StopShooting();
            gun.RemoveProjectiles();
            collider2d.enabled = true;
        }

        if (playerFound)
        {
            transform.position += Vector3.right * forwardMoveSpeed * Time.deltaTime;
            transform.position += moveDirections [curDirection] * vertMoveSpeed * Time.deltaTime;
            transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);

            if (defeated)
            {
                if (Mathf.Abs(playerController.transform.position.x - transform.position.x) < winDistance)
                {
                    playerReached = true;
                    director.LoadEndScene();
                }

                if (Mathf.Abs(playerController.transform.position.y - transform.position.y) < 0.2f)
                {
                    curDirection = MoveDirection.None;
                }
                else if (playerController.transform.position.y > transform.position.y)
                {
                    curDirection = MoveDirection.Up;
                }
                else
                {
                    curDirection = MoveDirection.Down;
                }
            }
        }
    }
예제 #3
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(initialWait));

        textAnimator.Show();
        textAnimator.AnimateText(speech, 0.02f, 1.2f);
        textAnimator.onTextAnimationFinished += OnSpeechFinished;

        yield return(new WaitForSeconds(0.8f));

        jimSpeech.Shush();
    }
예제 #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            var playrController = other.gameObject.GetComponent <PlayerController> ();

            if (playrController)
            {
                textAnim = playrController.textAnimator;
                textAnim.Show();
                textAnim.onTextAnimationFinished += HideTextBox;
                textAnim.AnimateText(text, 0.05f, 1.5f);
            }
        }
    }
예제 #5
0
    public void RestartMovement()
    {
        // write some text
        if (!text.IsVisible())
        {
            text.Show();
            text.onTextAnimationFinished += HideText;
            text.AnimateText(textOnDeath [UnityEngine.Random.Range(0, textOnDeath.Length)]);
        }
        // after animation/text finished: restart movements

        cameraManager.MoveToInitialStart();

        playerController.SetMovement(true);

        foreach (var n in npcs)
        {
            if (n)
            {
                n.SetMovement(true);
            }
        }

        foreach (var e in enemies)
        {
            if (e)
            {
                e.SetMovement(true);
            }
        }

        foreach (var b in backgrounds)
        {
            b.StartMovement();
        }

        collider2d.enabled = true;

        damageRunning = false;
    }
예제 #6
0
 void Start()
 {
     text.Show();
     text.onTextAnimationFinished += OnSpeechOver;
     text.AnimateText(speech [speechIndex], 0.04f, 0.8f);
 }
예제 #7
0
 private void DoWoof()
 {
     textAnimator.AnimateText(speech, 0.05f, 0.2f);
 }