示例#1
0
        public override void Run_Node()
        {
            if (ActorManager.Is_Actor_On_Scene(actor_name))
            {
                if (!slide_out && !fade_out)
                {
                    ActorManager.Remove_Actor(actor_name);
                    Finish_Node();
                }
                else
                {
                    Actor actor = ActorManager.Get_Actor(actor_name);

                    if (fade_out)
                    {
                        // Fade out
                        actor.Fade_Out(fade_out_time);
                    }
                    else
                    {
                        // Slide out
                        actor.Slide_Out(1f);
                    }

                    StartCoroutine(Wait(actor));
                }
            }
            else
            {
                Debug.Log(actor_name + " is not on the scene. Remember to correctly name your actor and use 'EnterActorNode'");

                Finish_Node();
            }
        }
示例#2
0
        IEnumerator Fade_Out_Coroutine(float over_time)
        {
            if (!ActorManager.exiting_actors.Contains(this))
            {
                ActorManager.exiting_actors.Add(this);
            }

            Image img       = this.GetComponent <Image>();
            Color tmp_color = img.color;

            tmp_color.a = 1;
            float value = 0;

            while (value < over_time)
            {
                value      += Time.deltaTime;
                tmp_color.a = Mathf.Lerp(1, 0, value / over_time);
                img.color   = tmp_color;
                yield return(0);
            }

            // Remove this actor after we're done
            Debug.Log("Removing actor " + actor_name);
            ActorManager.Remove_Actor(this.actor_name);

            yield break;
        }
示例#3
0
        public void Update()
        {
            is_moving = false;
            // Move towards desired position if we are not at our desired position
            if (this.rect.localPosition != desired_position)
            {
                this.rect.localPosition = Vector3.Lerp(this.rect.localPosition, desired_position, 3f * Time.deltaTime);
                //this.transform.position = Vector3.Lerp(this.transform.position, desired_position, 3f * Time.deltaTime);

                if (Vector2.Distance(this.rect.localPosition, desired_position) > 1f)
                {
                    is_moving = true;
                }
            }

            // If sliding out, check if we're visible. If we're not visible, remove the actor
            if (remove_when_out_of_sight && Mathf.Abs(this.rect.localPosition.x - desired_position.x) <= 30)
            {
                ActorManager.Remove_Actor(this.actor_name);
            }
        }
示例#4
0
        public override void Run_Node()
        {
            if (!slide_out && !fade_out)
            {
                for (int x = ActorManager.actors_on_scene.Count - 1; x >= 0; x--)
                {
                    Debug.Log("Exit all immediately: " + ActorManager.actors_on_scene[x].actor_name);
                    ActorManager.Remove_Actor(ActorManager.actors_on_scene[x]);
                }
            }
            else
            {
                for (int x = ActorManager.actors_on_scene.Count - 1; x >= 0; x--)
                {
                    Debug.Log("Exit all: " + ActorManager.actors_on_scene[x].actor_name);
                    Actor actor = ActorManager.actors_on_scene[x];

                    if (fade_out)
                    {
                        // Fade out
                        actor.Fade_Out(1f);
                    }
                    else
                    {
                        // Slide out
                        actor.Slide_Out(1f);
                    }
                }
            }

            if (wait_for_actors_to_exit)
            {
                StartCoroutine(Wait());
            }
            else
            {
                Finish_Node();
            }
        }