Пример #1
0
        /// <summary>
        /// Removes the object from the game (from TeamManager and from GroupManager).
        /// </summary>
        /// <param name="gameObject">The removing game object.</param>
        public void RemoveObject(IGameObject gameObject)
        {
            var castedImgo = gameObject as IMovableGameObject;

            if (castedImgo != null)
            {
                // Removes movebla object
                teamMgr.RemoveFromOwnTeam(castedImgo);
                groupMgr.DestroyGameObject(castedImgo);
            }
            else
            {
                // Removes static object
                var castedIsgo = gameObject as IStaticGameObject;
                teamMgr.RemoveFromOwnTeam(castedIsgo);
                groupMgr.DestroyGameObject(castedIsgo);
            }
        }