Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (VerifyHouse() && mode == Mode.ExitHouse)
        {
            mode = Mode.Scatter;
        }

        if (mode == Mode.Eyes)
        {
            VerifyOnHouse();
        }


        switch (mode)
        {
        case Mode.Chase:
            if (!followscript.enabled)
            {
                followscript.enabled = true;
            }
            frightscript.enabled = false;
            SetTarget();
            break;

        case Mode.Scatter:
            if (!followscript.enabled)
            {
                followscript.enabled = true;
            }
            frightscript.enabled = false;
            followscript.SetScatter();
            break;

        case Mode.Fright:
            followscript.enabled = false;
            frightscript.enabled = true;
            break;

        case Mode.Eyes:
            frightscript.enabled = false;
            if (!followscript.enabled)
            {
                followscript.enabled = true;
            }
            followscript.ReturnHome();
            break;

        case Mode.ExitHouse:
            if (!followscript.enabled)
            {
                followscript.enabled = true;
            }
            followscript.CanEnterHouse = false;
            frightscript.enabled       = false;
            followscript.SetTarget(new Vector2(0, 4.5f));
            break;

        case Mode.Waiting:
            followscript.enabled = false;
            frightscript.enabled = false;
            GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            break;
        }
    }