コード例 #1
0
        /// <summary>
        /// Add an object to the list
        /// </summary>
        /// <param name="obj">The object to be added</param>
        /// <returns>True when successful, false otherwise</returns>
        public bool AddObject(GameObject obj)
        {
            try
            {
                lock (GameObjects)
                {
                    if (obj.GetType() == typeof(LightClass))
                    {
                        ((LightClass)obj).index = ++_index;
                    }
                    obj.ID = ++_id;
                    GameObjects.Add(obj);
                }
            }
            catch (Exception e)
            {
                Engine.GameEngine.Exception.Exceptions.Add(new ExceptionData(e.Message, e.Source, e.StackTrace));
                return false;
            }

            return true;
        }