Пример #1
0
 static void Prefix(ref SeagullState newState)
 {
     if (newState == SeagullState.Peck)
     {
         newState = SeagullState.FlyAway;
         RConsole.Log("No More Peck: Seagull is flying off now");
     }
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     state = SeagullState.IDLE;
     if (SceneManager.GetActiveScene().name == "Seagull_Game")
     {
         gameObject.tag = "Untagged";
     }
 }
Пример #3
0
        public override string GetNextLine()
        {
            string line = null;

            if (!GlobalState.instance.seagullGameComplete)
            {
                switch (state)
                {
                case SeagullState.IDLE:
                    state = SeagullState.DIALOG_1;
                    AudioSource.PlayClipAtPoint(clip, new Vector3(0, 0, 0));
                    line = "Fufufufu... What have we here?";
                    break;

                case SeagullState.DIALOG_1:
                    state = SeagullState.DIALOG_2;
                    line  = "Good sir, you look positively... delicious.";
                    break;

                case SeagullState.DIALOG_2:
                    state = SeagullState.DIALOG_3;
                    line  = "I'm sure a strong, handsome fellow such as yourself could give me a helping... ah... fin!";
                    break;

                case SeagullState.DIALOG_3:
                    state = SeagullState.DIALOG_4;
                    line  = "I seem to have misplaced my fishi - errr, Nourishment Acquiring Apparatus.";
                    break;

                case SeagullState.DIALOG_4:
                    state = SeagullState.DIALOG_END;
                    line  = "Be a dear and go fetch it for me, won't you? Fufufufu...";
                    break;

                case SeagullState.DIALOG_END:
                    state = SeagullState.DIALOG_DONE;
                    line  = null;
                    SceneManager.LoadScene("Seagull_Game");
                    break;
                }
            }
            else
            {
                if (GlobalState.instance.talkedToSeagull)
                {
                    switch (state)
                    {
                    case SeagullState.CLOSE:
                        state = SeagullState.AFTER_MG_IDLE;
                        line  = null;
                        break;

                    default:
                        state = SeagullState.CLOSE;
                        line  = "Thank you again for your assistance!";
                        break;
                    }
                }
                else
                {
                    switch (state)
                    {
                    case SeagullState.AFTER_MG_1:
                        state = SeagullState.AFTER_MG_2;
                        line  = "And now, I think it's time to catch ourselves some delicious, nutritious...";
                        break;

                    case SeagullState.AFTER_MG_2:
                        state = SeagullState.CLOSE;
                        line  = "Sea cucumbers! Oh, how I do love sea cucumbers!";
                        break;

                    case SeagullState.CLOSE:
                        state = SeagullState.AFTER_MG_IDLE;
                        line  = null;
                        GlobalState.instance.talkedToSeagull = true;
                        SceneManager.LoadScene("Beach_Seagull");
                        break;

                    default:
                        state = SeagullState.AFTER_MG_1;
                        line  = "Fufufufu! Thank you kindly, master fish.";
                        break;
                    }
                }
            }

            return(line);
        }
Пример #4
0
    private void SetState(SeagullState newState)
    {
        animator.SetBool("idle", false);
        animator.SetBool("walk", false);
        animator.SetBool("fly", false);
        animator.SetBool("landing", false);
        animator.SetBool("takeoff", false);
        agent.enabled = false;
        moveProgress  = 0;
        flySpeed      = Random.Range(.1f, 1f);
        switch (newState)
        {
        case SeagullState.IDLE:
            animator.SetBool("idle", true);
            agent.enabled = true;
            break;

        case SeagullState.FLYING:
            animator.SetBool("fly", true);
            moveRotationStart = transform.rotation;
            movePointStart    = transform.position;
            movePointFinish   = SeagullManager.Instance.GetRandomFlyPoint();
            break;

        case SeagullState.LANDING:
            animator.SetBool("landing", true);
            movePointStart    = transform.position;
            moveRotationStart = transform.rotation;
            moveProgress      = 0;
            break;

        case SeagullState.TAKEOFF:
            animator.SetBool("takeoff", true);
            movePointStart    = transform.position;
            moveRotationStart = transform.rotation;
            moveProgress      = 0;
            break;

        case SeagullState.WALKING_TO_FOOD:
            animator.SetBool("walk", true);
            transform.position = SeagullManager.Instance.landPoint.position;
            agent.enabled      = true;
            break;

        case SeagullState.WALKING_TO_TAKEOFF:
            animator.SetBool("walk", true);
            agent.enabled = true;
            break;

        case SeagullState.EATING:
            animator.Play("peck");
            agent.enabled = false;
            break;

        case SeagullState.FOLLOWING:
            animator.SetBool("walk", true);
            Player.Instance.AddAFriend();
            agent.enabled = true;
            agent.speed  *= 5f;
            break;

        default:
            break;
        }

        state = newState;
    }