예제 #1
0
 public void UpdateReferences(IComponent component)
 {
     if (component.GetType() == typeof(Animation))
     {
         Animation = (Animation)component;
     }
     else if (component.GetType() == typeof(Audio))
     {
         Audio = (Audio)component;
     }
     else if (component.GetType() == typeof(Camera))
     {
         Camera = (Camera)component;
     }
     else if (component.GetType() == typeof(Renderer))
     {
         Renderer = (Renderer)component;
     }
     else if (component.GetType() == typeof(RigidBody))
     {
         RigidBody = (RigidBody)component;
     }
     else if (component.GetType() == typeof(StaticSprite))
     {
         StaticSprite = (StaticSprite)component;
     }
     else if (component.GetType() == typeof(Transform))
     {
         Transform = (Transform)component;
     }
     else if (component.GetType() == typeof(Trigger))
     {
         Trigger = (Trigger)component;
     }
 }
예제 #2
0
        public BaseComponent(GameObject parent)
        {
            go = parent;

            Animation    = parent.Animation;
            Audio        = parent.Audio;
            Camera       = parent.Camera;
            Renderer     = parent.Renderer;
            RigidBody    = parent.RigidBody;
            StaticSprite = parent.StaticSprite;
            Transform    = parent.Transform;
            Trigger      = parent.Trigger;

            parent.ComponentAdded += UpdateReferences;
        }