Пример #1
0
    //callback
    //for when actor is supposed to change emote
    private void EmoteListener(object sender, TextIntEventArgs e)
    {
        //finds the sigular actor we want to manipulate
        DialogueActor da = FindActor(e.name);

        //makes sure that the found actor isn't null
        if (da != null)
        {
            //changes the emote to the wnated one if the names match
            da.ChangeEmote(e.value);
        }
    }
Пример #2
0
    //callback
    //for when actor is supposed to exit
    private void ExitListener(object sender, TextIntEventArgs e)
    {
        //finds the sigular actor we want to manipulate
        DialogueActor da = FindActor(e.name);

        //makes sure that the found actor isn't null
        if (da != null)
        {
            //get the game object of actor for faster access
            GameObject go = da.gameObject;

            //removes the actor from the list, doens't destroy them
            actors.Remove(da);

            //destroys the actor object
            da.MoveOffScreen();
        }
    }
Пример #3
0
    //callback
    //for when you want an actor to enter
    private void EnterListener(object sender, TextIntEventArgs e)
    {
        //hold gameobject that is being instantiated
        GameObject go =
            Instantiate((GameObject)Resources.Load(e.name)) as GameObject;

        //gets the dialogue actor component
        DialogueActor da = go.GetComponent <DialogueActor>();

        //set the parent to the parent container
        go.transform.SetParent(actorContainer.transform);

        //request wants actor to be off screen in the negative x direction
        if (e.value < 0)
        {
            //move only the character along the x-axis
            go.transform.localPosition = new Vector3(-1500f, 0f, 0f);
        }
        else
        {
            //move only the character along the x-axis
            go.transform.localPosition = new Vector3(1500f, 0f, 0f);
        }

        //assuming, it doesn't enter speaking, scales non-speaker down
        go.transform.localScale = new Vector3(90f, 90f, 0f);

        //holds the sprite renderer component for faster access
        SpriteRenderer renderer = da.spriteRenderer;

        //puts grey filter over sprite to un-highlight the nonspeaker
        renderer.color = Color.grey;

        //add object to the List
        actors.Add(da);
    }
Пример #4
0
    //callback
    //for when you want an actor to face left or right (default right)
    private void FaceListener(object sender, TextIntEventArgs e)
    {
        //finds the sigular actor we want to manipulate
        DialogueActor da = FindActor(e.name);

        //makes sure that the found actor isn't null
        if (da != null)
        {
            //holds the sprite renderer component for faster access
            SpriteRenderer renderer = da.spriteRenderer;

            //request wants actor to face in negative x
            if (e.value < 0)
            {
                //the sprites, by default, face left, so set the flip to false to face left
                renderer.flipX = false;
            }
            else
            {
                //set to true so the sprite flips to face right
                renderer.flipX = true;
            }
        }
    }