private void ToggleDialogBox(float speed, Vector3 source, Vector3 target)
 {
     //Hide Dialogue Box
     if (moveDialog)
     {
         moveDialog.Move(speed, source, target);
     }
 }
示例#2
0
    private void Move(int direction)
    {
        thistransform.localPosition = thistransform.localPosition + directionVector[direction] * tilelenght;

        moveTo.Move(thistransform.position);

        lookat.SetLook(thistransform.position);
    }
示例#3
0
    private void FixedUpdate()
    {
        if (m_target == null)
        {
            return;
        }

        float distance = MathHelpers.Azimuthal(transform.position - m_target.position).magnitude;

        if (distance < startFollowDistance)
        {
            DisableNavigationBehaviorsExcept(follow);
            follow.enabled = true;
        }
        else if (distance > stopFollowDistance && follow.enabled == true)
        {
            switch (stopFollowBehavior)
            {
            case StopFollowBehavior.StayPut:
            default:
                DisableNavigationBehaviorsExcept();
                break;

            case StopFollowBehavior.ReturnToHome:
                DisableNavigationBehaviorsExcept(moveTo);
                moveTo.enabled = true;
                moveTo.Move(m_homePosition,
                            () =>
                {
                    DisableAllBehaviors();
                    scan.enabled = true;
                });
                break;

            case StopFollowBehavior.Patrol:
                DisableNavigationBehaviorsExcept(patrol);
                patrol.enabled = true;
                break;
            }
        }

        if (distance < startTrackDistance)
        {
            track.enabled = true;
            scan.enabled  = false;
        }
        else if (distance > stopTrackDistance)
        {
            track.enabled = false;
            scan.enabled  = true;
        }
    }
示例#4
0
    private void Move(MoveTo moveTo)
    {
        var target = this.transform.position;
        target += transform.forward * (Random.Range(-range.size.z, range.size.z) * 0.5f);
        target += transform.right * (Random.Range(-range.size.x, range.size.x) * 0.5f);
        target += transform.up * (Random.Range(-range.size.y, range.size.y) * 0.5f);
        var delay = Random.Range(minDelay, maxDelay);
        var moveTime = Random.Range(minMoveTime, maxMoveTime);
        var lookTime = Random.Range(minLookTime, maxLookTime);
        var easeType = easeTypes[Random.Range(0, easeTypes.Count)];

        moveTo.Move(target, delay, moveTime, lookTime, easeType);
    }
示例#5
0
    private void FixedUpdate()
    {
        if (m_target == null)
        {
            return;
        }

        float distance = MathHelpers.Azimuthal(transform.position - m_target.position).magnitude;

        if (distance < startFollowingDistance)
        {
            DisableNavigationBehaviorsExcept(follow);
            follow.enabled = true;
        }
        else if (distance > stopFollowingDistance && follow.enabled == true)
        {
            // Return back to starting position and resume default behavior
            DisableNavigationBehaviorsExcept();
            moveTo.enabled = true;
            moveTo.Move(m_homePosition, () => { EnableDefaultNavigationBehavior(); });
        }

        if (distance < startTrackDistance)
        {
            DisableTurretBehaviorsExcept(track);
            track.enabled        = true;
            track.OnLockObtained =
                () =>
            {
                m_lockedOnTarget = true;
                fire.enabled     = true;
            };
            track.OnLockLost =
                () =>
            {
                m_lockedOnTarget = false;
                fire.enabled     = false;
            };
        }
        else if (distance > stopTrackDistance && track.enabled == true)
        {
            // Reset turret, stop firing, and resume default behavior
            DisableTurretBehaviorsExcept();
            resetTurret.enabled    = true;
            resetTurret.OnComplete = () => { EnableDefaultTurretBehavior(); };
            fire.enabled           = false;
            m_lockedOnTarget       = false;
        }
    }
    // Update is called once per frame
    private void Update()
    {
        bool JugadorALaVista = VisionDeJugador();

        advertencia.SetActive(JugadorALaVista);
        if (JugadorALaVista == true)
        {
            viewed += Time.deltaTime;

            if (viewed > 2f)
            {
                SceneManager.LoadScene("SampleScene");
            }
        }
        else
        {
            viewed = 0;
            enemyMove.Move();
        }
    }
    private IEnumerator Sequence()
    {
        Debug.Log("Starting Tutorial 4");

        if (TutorialManager.Instance)
        {
            TutorialManager.Instance.DisableBackground();
            TutorialManager.Instance.BuildTutorialLevel(3);
        }

        //Display MemoryPhase Screen
        if (memoryPhaseOuterContainer)
        {
            memoryPhaseOuterContainer.transform.SetSiblingIndex(1);
        }

        if (memoryPhaseContainer)
        {
            memoryPhaseContainer.SetActive(true);
        }

        yield return(new WaitForSeconds(delay));

        //Play Dialog
        if (dialogueBox)
        {
            dialogueBox.transform.SetSiblingIndex(3);
        }

        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -1000f, 0f), new Vector3(0f, -350f, 0));
        }

        //Start Dialogue
        if (DialogueManager.Instance)
        {
            DialogueManager.Instance.StartDialogue(dialogues[0]);
            DialogueManager.Instance.IsSectionComplete = false;
        }

        //Wait for user to exhaust dialogue
        while (DialogueManager.Instance && !DialogueManager.Instance.IsSectionComplete)
        {
            yield return(null);
        }

        //Hide dialog box
        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -350f, 0f), new Vector3(0f, -1000f, 0));
        }

        yield return(new WaitForSeconds(1.0f));

        //Activate the timer .
        if (TutorialManager.Instance)
        {
            TutorialManager.Instance.IsTimerActive = true;

            TutorialManager.Instance.EnableCountdownTimer();
            TutorialManager.Instance.StartCountdownTimer();

            yield return(new WaitForSeconds(5.0f));

            TutorialManager.Instance.EnableInGameTimer();
        }



        //Activate the Game Container
        if (gameOuterContainer)
        {
            gameOuterContainer.transform.SetSiblingIndex(1);
        }

        if (gameContainer)
        {
            gameContainer.SetActive(true);
        }

        if (DialogueManager.Instance)
        {
            DialogueManager.Instance.IsSectionComplete = false;
        }

        //Wait for user to exhaust dialogue
        while (DialogueManager.Instance && !DialogueManager.Instance.IsSectionComplete)
        {
            yield return(null);
        }

        yield return(new WaitForSeconds(2.0f));

        Debug.Log("Time for tutorial 5");
        if (anim)
        {
            anim.SetInteger("Tutorial", 5);
        }
    }
示例#8
0
    //Tutorial 2
    private IEnumerator Sequence()
    {
        Debug.Log("Starting Tutorial 2");
        TutorialManager.Instance.DisableBackground();

        //Display MemoryPhase Screen
        if (memoryPhaseOuterContainer)
        {
            memoryPhaseOuterContainer.transform.SetSiblingIndex(1);
        }

        if (memoryPhaseContainer)
        {
            memoryPhaseContainer.SetActive(true);
        }

        yield return(new WaitForSeconds(delay));

        //Play Dialog
        if (dialogueBox)
        {
            dialogueBox.transform.SetSiblingIndex(3);
        }

        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -1000f, 0f), new Vector3(0f, -350f, 0));
        }

        yield return(new WaitForSeconds(1f));

        //Display first Dialogue.
        if (DialogueManager.Instance)
        {
            DialogueManager.Instance.StartDialogue(dialogues[0]);
        }

        //Wait for user to exhaust dialogue
        while (DialogueManager.Instance && !DialogueManager.Instance.IsSectionComplete)
        {
            yield return(null);
        }

        //Hide dialog box
        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -350f, 0f), new Vector3(0f, -1000f, 0));
        }

        yield return(new WaitForSeconds(1.0f));

        //Activate the Game Container
        if (gameOuterContainer)
        {
            gameOuterContainer.transform.SetSiblingIndex(1);
        }

        if (gameContainer)
        {
            gameContainer.SetActive(true);
        }

        yield return(new WaitForSeconds(1.0f));

        //Show dialog Box
        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -1000f, 0f), new Vector3(0f, -350f, 0));
        }

        yield return(new WaitForSeconds(1.0f));

        //Display first Dialogue.
        if (DialogueManager.Instance)
        {
            DialogueManager.Instance.StartDialogue(dialogues[1]);
            DialogueManager.Instance.IsSectionComplete = false;
        }

        //Wait for user to exhaust dialogue
        while (DialogueManager.Instance && !DialogueManager.Instance.IsSectionComplete)
        {
            yield return(null);
        }


        //Show dialog Box
        if (moveDialog)
        {
            moveDialog.Move(0.3f, new Vector3(0f, -350f, 0f), new Vector3(0f, -1000f, 0));
        }

        yield return(new WaitForSeconds(1.0f));


        if (anim)
        {
            anim.SetInteger("Tutorial", 3);
        }

        Debug.Log("State Tut 2 Im done here...");
    }