<commit_before>﻿using System;
using System.Collections.Generic;
using GameFramework.Internal;

namespace GameFramework
{
    public class Actor : GameEntityContainer<Actor>
    {
        private Scene scene;

        public Scene Scene
        {
            get
            {
                return scene;
            }
            set
            {
                scene = value;

                foreach (Actor actor in children)
                {
                    actor.Scene = value;
                }
            }
        }

        public Actor Parent { get; set; }

        public string Name { get; set; }

        public Vector3 WorldPosition
        {
            get
            {
                Vector3 offset = Vector3.Zero;
                Actor parent = Parent;
                while (parent != null)
                {
                    offset += parent.LocalPosition;
                    parent = parent.Parent;
                }

                return LocalPosition + offset;
            }
            set
            {
                Vector3 offset = value - WorldPosition;
                LocalPosition += offset;
            }
        }

        public Vector3 LocalPosition { get; set; }

        private ComponentContainer componentContainer;

        public Actor(string name = "Actor")
        {
            this.Name = name;
            componentContainer = new ComponentContainer(this);
        }

        public override void AddChild(Actor actor)
        {
            actor.Parent = this;
            actor.Scene = Scene;

            base.AddChild(actor);
        }

        public List<Actor> GetAllChildren()
        {
            return new List<Actor>(children);
        }

        public override void Start()
        {
            componentContainer.Start();

            base.Start();
        }

        public override void Update(float deltaTime)
        {
            componentContainer.Update(deltaTime);

            base.Update(deltaTime);
        }

        public override void OnDestroy()
        {
            componentContainer.OnDestroy();
            componentContainer = null;

            base.OnDestroy();
        }

        public void AddComponent(ActorComponent component)
        {
            componentContainer.AddChild(component);
        }

        public WeakReference<TComponent> GetComponent<TComponent>() where TComponent : class
        {
            return componentContainer.GetComponent<TComponent>();
        }

        public List<WeakReference<TComponent>> GetAllComponents<TComponent>() where TComponent : class<commit_msg>Now Draw() will be properly called on actor components<commit_after>﻿using System;
using System.Collections.Generic;
using GameFramework.Internal;

namespace GameFramework
{
    public class Actor : GameEntityContainer<Actor>
    {
        private Scene scene;

        public Scene Scene
        {
            get
            {
                return scene;
            }
            set
            {
                scene = value;

                foreach (Actor actor in children)
                {
                    actor.Scene = value;
                }
            }
        }

        public Actor Parent { get; set; }

        public string Name { get; set; }

        public Vector3 WorldPosition
        {
            get
            {
                Vector3 offset = Vector3.Zero;
                Actor parent = Parent;
                while (parent != null)
                {
                    offset += parent.LocalPosition;
                    parent = parent.Parent;
                }

                return LocalPosition + offset;
            }
            set
            {
                Vector3 offset = value - WorldPosition;
                LocalPosition += offset;
            }
        }

        public Vector3 LocalPosition { get; set; }

        private ComponentContainer componentContainer;

        public Actor(string name = "Actor")
        {
            this.Name = name;
            componentContainer = new ComponentContainer(this);
        }

        public override void AddChild(Actor actor)
        {
            actor.Parent = this;
            actor.Scene = Scene;

            base.AddChild(actor);
        }

        public List<Actor> GetAllChildren()
        {
            return new List<Actor>(children);
        }

        public override void Start()
        {
            componentContainer.Start();

            base.Start();
        }

        public override void Update(float deltaTime)
        {
            componentContainer.Update(deltaTime);

            base.Update(deltaTime);
        }

        public override void Draw(float deltaTime)
        {
            componentContainer.Draw(deltaTime);

            base.Draw(deltaTime);
        }

        public override void OnDestroy()
        {
            componentContainer.OnDestroy();
            componentContainer = null;

            base.OnDestroy();
        }

        public void AddComponent(ActorComponent component)
        {
            componentContainer.AddChild(component);
        }

        public WeakReference<TComponent> GetComponent<TComponent>() where TComponent : class
        {
            return componentContainer.GetComponent<TComponent>();
        }

        public List<WeakReference<TComponent>> GetAllComponents<TComponent>() where TComponent : class
{'fraction_non_alphanumeric': 0.07140214576396596, 'fraction_numerical': 0.001849796522382538, 'mean_word_length': 1.3206008583690987, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2999406', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1161, 'n_words': 296}