Пример #1
0
        /// <summary>
        /// Duplicates this instance.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T Duplicate <T>() where T : GameObject, new()
        {
            T result = new T();

            result.AI      = AI.Clone() as AIBase;
            result.posX    = posX;
            result.posY    = posY;
            result.offsetX = offsetX;
            result.offsetY = offsetY;

            foreach (Component c in Components)
            {
                result.AddComponent(c.Clone() as Component);
            }

            return(result);
        }