Пример #1
0
    void Start()
    {
        foreach (ScoreStar ss in stars)
        {
            ss.mr.material = Instantiate(ss.mr.material);
            ss.mr.material.SetColor("_ColorA", Library.instance.colorLocked);
        }

        if (GameManager.instance.level != null)
        {
            OnScoreChange();
            GameManager.instance.level.OnScoreChange += () => this.OnScoreChange();
            speak.Say("Good luck boys!");
            foreach (ScoreStar ss in stars)
            {
                ss.obj.SetActive(true);
            }
        }
        else
        {
            foreach (ScoreStar ss in stars)
            {
                ss.obj.SetActive(false);
            }
            speak.Say("Hey");
        }

        raccountObject.SetActive(false);
        UpdateRaccount();
    }
Пример #2
0
    float talkThreashold = 0.98F;     // The higher, the less likely they are to talk.

    // Use this for initialization
    void Awake()
    {
        player = GameObject.Find("Player").transform;
        graph  = GameObject.Find("NavigationGraph").GetComponent <GraphScript>();
        voice  = transform.FindChild("Speech").GetComponent <Speak>();

        transform.FindChild("Cube").renderer.material.mainTexture = Resources.Load("Villager-" + Random.Range(1, 4)) as Texture;


        float spawnSay = Random.value;

        if (spawnSay > 0.9)
        {
            voice.Say("Exuberant!");
        }
        else if (spawnSay > 0.8)
        {
            voice.Say("Alive again!");
        }
        else if (spawnSay > 0.7)
        {
            voice.Say("Why?");
        }
        else if (spawnSay > 0.6)
        {
            voice.Say("Hello, world!");
        }
        else if (spawnSay > 0.5)
        {
            voice.Say("Statistical!");
        }
        else if (spawnSay > 0.4)
        {
            voice.Say("Help");
        }
        else if (spawnSay > 0.3)
        {
            voice.Say("*hick*");
        }
        else if (spawnSay > 0.2)
        {
            voice.Say("Hats!");
        }
        else if (spawnSay > 0.1)
        {
            voice.Say("I'm lost.");
        }
    }
Пример #3
0
    // Use this for initialization
    void Awake()
    {
        player = GameObject.Find("Player").transform;
        graph = GameObject.Find("NavigationGraph").GetComponent<GraphScript>();
        voice = transform.FindChild("Speech").GetComponent<Speak>();

        transform.FindChild("Cube").renderer.material.mainTexture = Resources.Load("Villager-" + Random.Range(1,4)) as Texture;

        float spawnSay = Random.value;

        if(spawnSay > 0.9) voice.Say("Exuberant!");
        else if(spawnSay > 0.8) voice.Say("Alive again!");
        else if(spawnSay > 0.7) voice.Say("Why?");
        else if(spawnSay > 0.6) voice.Say("Hello, world!");
        else if(spawnSay > 0.5) voice.Say("Statistical!");
        else if(spawnSay > 0.4) voice.Say("Help");
        else if(spawnSay > 0.3) voice.Say("*hick*");
        else if(spawnSay > 0.2) voice.Say("Hats!");
        else if(spawnSay > 0.1) voice.Say("I'm lost.");
    }
Пример #4
0
    void Say(params string[] s)
    {
        if (s.Length > 0)
        {
            float sayChanceInc = 1.0F / s.Length;
            float sayChance    = sayChanceInc;

            float rand = Random.value;

            print(rand + " <= " + sayChance);

            for (int i = 0; i < s.Length; i++)
            {
                if (rand <= sayChance)
                {
                    voice.Say(s[i]);
                    break;
                }

                sayChance += sayChanceInc;
            }
        }
    }
Пример #5
0
    void Update()
    {
        if (graph.nodes.Count - 2 > nodesToRemember)
        {
            nodesToRemember = graph.nodes.Count - 2;
        }
        else if (graph.nodes.Count < nodesToRemember)
        {
            nodesToRemember = graph.nodes.Count;
        }
        if (rigidbody.velocity.magnitude > 0.01F)
        {
            //Vector3 look = transform.position + rigidbody.velocity;
            Vector3 look;

            if (pathToFollow.Count > 0)
            {
                look = graph.nodes[pathToFollow[0]].transform.position;
            }
            else
            {
                look = transform.position + rigidbody.velocity;
            }

            look.y = transform.position.y;
            transform.LookAt(look, new Vector3(0, 1, 0));
        }
        if (transform.position.y < 0)
        {
            transform.position = new Vector3(transform.position.x, transform.localScale.y * 1.1F, transform.position.z);
        }

        if (rigidbody.velocity.magnitude > 5F)
        {
            if (Random.value > talkThreashold)
            {
                float spawnSay = Random.value;
                if (spawnSay > 0.95F)
                {
                    voice.Say("WAAAAAHH", true);
                }
                else if (spawnSay > 0.9F)
                {
                    voice.Say("OH NO", true);
                }
                else if (spawnSay > 0.8F)
                {
                    voice.Say("TOO FAST", true);
                }
                else if (spawnSay > 0.7F)
                {
                    voice.Say("AWAY!", true);
                }
                else if (spawnSay > 0.5F)
                {
                    voice.Say("I MADE A MISTAKEEEEEE~", true);
                }
                else if (spawnSay > 0.3F)
                {
                    voice.Say("WHOOOP", true);
                }
                else if (spawnSay > 0.3F)
                {
                    voice.Say("AHH", true);
                }
                else if (spawnSay > 0.2F)
                {
                    voice.Say("GOTTA GO FAST", true);
                }
                else if (spawnSay > 0.1F)
                {
                    voice.Say("PATHFINDING?", true);
                }
            }

            rigidbody.velocity *= 0.3F * Time.deltaTime;
        }

        if (rigidbody.velocity.magnitude > 1F)
        {
            animation.Blend("Walk");
        }
        else if (idleDelay > 0)
        {
            animation.Blend("Idle");

            if (Random.value > talkThreashold)
            {
                float spawnSay = Random.value;
                if (spawnSay > 0.998F)
                {
                    voice.Say("Hello darkness my old friend");
                }
                else if (spawnSay > 0.9F)
                {
                    voice.Say("I'm here.");
                }
                else if (spawnSay > 0.8F)
                {
                    voice.Say("What's that?");
                }
                else if (spawnSay > 0.7F && homeID != -1)
                {
                    voice.Say("Look at my hat! Everybody! Anybody?");
                }
                else if (spawnSay > 0.7F && basketID == -1)
                {
                    voice.Say("No hats...");
                }
                else if (spawnSay > 0.5F)
                {
                    voice.Say("Pentagons...");
                }
                else if (spawnSay > 0.3F)
                {
                    voice.Say("*hick*");
                }
                else if (spawnSay > 0.3F)
                {
                    voice.Say("Hrm.");
                }
                else if (spawnSay > 0.2F)
                {
                    voice.Say("Maybe...");
                }
                else if (spawnSay > 0.1F)
                {
                    voice.Say("It's not time.");
                }
            }
        }

        if (pathToFollow.Count == 0)
        {
            rigidbody.velocity = Vector3.zero;
        }
    }