// Start is called before the first frame update
    void Awake()
    {
        m_rigidBody   = GetComponent <Rigidbody2D>();
        m_soundPing   = GetComponentInChildren <SoundPing>();
        m_animator    = GetComponent <Animator>();
        m_wordBalloon =
            transform.parent.GetComponentInChildren <WordBalloon>();
        m_spriteRenderer = GetComponent <SpriteRenderer>();

        m_humanity = startingHumanity;
    }
    public static void SpawnBalloon(string text, Color color, float life, Vector3 pos, Transform trans, string tag)
    {
        Status.RemoveBalloonWithTag(tag);
        WordBalloon wordy = new WordBalloon();

        wordy.text      = text;
        wordy.color     = color;
        wordy.fadeTime  = Time.time + life;
        wordy.transform = trans;
        wordy.localPos  = trans != null?trans.InverseTransformPoint(pos) : pos;

        wordy.tag = tag;
        Status.balloons.Add(wordy);
    }
Exemple #3
0
    public void Initialize(GameObject player, GameObject npc)
    {
        m_player         = player;
        m_npc            = npc;
        m_playerBalloon  = player.GetComponentInChildren <WordBalloon>();
        m_npcBalloon     = npc.GetComponentInChildren <WordBalloon>();
        m_playerBehavior = player.GetComponentInChildren <PlayerBehavior>();
        m_npcBehavior    = npc.GetComponentInChildren <OfficeWorkerBehavior>();

        // Set word balloons of interacting characters to appropriate update mode
        m_playerBalloon.gameObject.GetComponent <Animator>().updateMode =
            AnimatorUpdateMode.UnscaledTime;
        m_npcBalloon.gameObject.GetComponent <Animator>().updateMode =
            AnimatorUpdateMode.UnscaledTime;

        // Turn off player's sound ping

        m_player.GetComponentInChildren <SoundPing>().gameObject.
        GetComponent <SpriteRenderer>().enabled = false;
    }