Example #1
0
    // Async method for move camera to character
    private IEnumerator MoveCameraToCharacterAsync(CharacterScript character, MoveCameraToCallback callback)
    {
        var lookToEvent = new GameEvent("look to", new Dictionary <string, object>()
        {
            { "gameobject", character.transform.gameObject },
            { "instant", false },
            { "synchronous", true }
        });

        Game.main.enqueueEvent(lookToEvent);
        yield return(new WaitForEventFinished(lookToEvent));

        callback(true);
    }
Example #2
0
    // Async method for trigger animation
    private IEnumerator triggerAnimationAsync(CharacterScript character, string animationName, string then, MoveCameraToCallback callback)
    {
        Entity entity = character.transform.GetComponent(typeof(Entity)) as Entity;

        GameEvent animationEvent = null;

        if (then == "")
        {
            animationEvent = new GameEvent("animate entity", new Dictionary <string, object>()
            {
                { "decorationanimator", entity.decorationAnimator },
                { "animation", animationName },
                { "synchronous", true }
            });
        }
        else
        {
            animationEvent = new GameEvent("animate entity", new Dictionary <string, object>()
            {
                { "decorationanimator", entity.decorationAnimator },
                { "animation", animationName },
                { "then", then },
                { "synchronous", true }
            });
        }

        Game.main.enqueueEvent(animationEvent);
        yield return(new WaitForEventFinished(animationEvent));

        callback(true);
    }
Example #3
0
 // Trigger animation
 public void TriggerAnimation(CharacterScript character, string animationName, string then, MoveCameraToCallback callback)
 {
     StartCoroutine(triggerAnimationAsync(character, animationName, then, callback));
 }
Example #4
0
 // Camera look to Character
 public void MoveCameraToCharacter(CharacterScript character, MoveCameraToCallback callback)
 {
     StartCoroutine(MoveCameraToCharacterAsync(character, callback));
 }